Running EC2 Environments That Require Static Private IP Pools

Reading Time: 2 minutes

At Spotinst, we have begun operating under the belief that any use case can be a good use case for Spot Instances given the right set of tools.

This has led us to work hard in order to release support for running Stateful applications with both 100% availability and data consistency. Since then, Stateful applications have become a major part of our offering.

And today, we excited to announce Private IP Pools, allowing our customers to run workloads using specific private IP addresses that will be kept throughout the entire workload lifecycle.

How it works

When selected, Private IP Pooling will ensure that your instances will be associated with specific Private IPs from your Amazon VPC’s specific Subnet.

Here’s what happens under the hood:

  1. You define a list of Private IPs for the cluster. Each one of these will then be allocated to an instance in your Elastigroup.
  2. When the Private IP is in use, Elastigroup will not be able to start the requested instance and its state will be ‘paused’. At any point in time, when the private IP is free, you can “resume” the instance.
  3. Elastigroup will create the ENI and associate it to the newly created instance.  The IP address will be kept through the entire lifecycle, including any points where your Spot Instances are interrupted.
  4. When an instance replacement is taking place, Elastigroup will first save the ENI upon termination of the instance. Only then will it terminate the original instance and launch a new instance with the saved ENI.

NOTE: If the number of requested instances exceeds the number of provided address in the pool, a random IP from the subnet will be assigned to the instance.

Common Use Cases

  • A cluster that communicates internally based on private IPs
  • Customers who manage their workloads based on IP addresses
  • Migrating existing services without having to change configuration
  • Load-balanced instances that register based on private IP
  • NoSQL (Cassandra / Scylla / Mongo) databases that require a fixed set of Private IPs

Configuration

  1. Log in to your Spotinst console. (https://console.spotinst.com)
  2. Create a new Elastigroup or edit an existing group. On the ‘Compute’ page, scroll down to the ‘Stateful’ section.
  3. Check the ‘Maintain Private IP’ and ‘Assign Specific Private IPs’ checkboxes.
  4. Specify any requested IPs and add them using the blue ‘add’ button
    * Any specified IP will be added to a list of configured IPs and will be presented at the bottom of the section

API & 3rd Party Provisioning Tools

{
  "group": {
      "strategy": {
          "persistence": {
              "shouldPersistPrivateIp": true
          }
      },
      "compute": {
         "privateIps": [
            "10.1.1.1",
            "10.1.1.2",
            "10.1.1.3",
            "10.1.21.31",
            "10.12.1.155",
            "10.12.1.153",
            "10.12.1.154",
            "10.12.1.156",
            "10.12.1.157"
        ]
     }
  }
}

That’s it! Using Private IP Pools will simplify the way you consume EC2 resources and allow you to save even more on stateful apps and other complex use cases. If you have any further questions, don’t hesitate to contact our customer success engineers at cs@spotinst.com