Skip to main content

Elastic IP

Elastic IP (EIP)

An Elastic IP (EIP) is a static, public IPv4 address that you can allocate to your cloud account and associate with your cloud resources, such as virtual machine instances or network interfaces. Unlike the dynamic public IPs that are automatically assigned to instances and can change, an EIP remains fixed until you explicitly release it.

This concept was popularized by Amazon Web Services (AWS) but is available in various forms across different cloud providers.

Key Characteristics

  • Static and Persistent: An EIP does not change when you stop and restart an instance. It remains associated with your account, not the instance itself.
  • Account-Bound: You allocate an EIP to your account within a specific region. It's yours to manage until you decide to release it.
  • Re-mappable: You can easily disassociate an EIP from one resource and associate it with another. This ability to "remap" the IP address is what makes it "elastic."
  • One-to-One Association: An EIP can only be associated with one resource at a time.

Common Use Cases

  1. High Availability and Failover:

    • If an instance serving traffic fails, you can quickly remap its EIP to a healthy, standby instance. This masks the failure from your users, as they continue to access the same static IP address, ensuring minimal downtime.
  2. Stable Public Endpoint:

    • For servers that need a consistent, public-facing IP address (e.g., a web server, mail server, or an endpoint for an API), an EIP provides a stable address that can be used in DNS records. This prevents you from having to update DNS entries every time an instance is restarted.
  3. Allowlisting:

    • When external services need to allowlist your application's IP address for security reasons, using an EIP ensures that access is not broken if your underlying instance changes.

How EIPs Work

  1. Allocation: You first allocate a new EIP from the cloud provider's pool of public IPv4 addresses.
  2. Association: You then associate the EIP with a specific resource, typically a virtual machine instance or a network interface. When you do this, the EIP becomes the public IP address of that resource.
  3. Disassociation: You can disassociate the EIP from a resource at any time. The resource will lose its public IP, and the EIP returns to your account's pool of available EIPs.
  4. Release: If you no longer need the EIP, you can release it back to the cloud provider. Once released, you may not be able to get the same IP address again.

Important Considerations

  • Cost: Most cloud providers charge for EIPs, particularly when they are not associated with a running instance. This is to prevent users from hoarding scarce public IPv4 addresses. An EIP associated with a running instance is often free or included in the instance cost.
  • Regional Scope: EIPs are typically specific to a cloud region and cannot be moved between regions.
  • IPv4 Only: Elastic IPs are generally for IPv4. IPv6 addresses are more plentiful and often have different allocation and management models.
  • Limits: There is usually a default limit on the number of EIPs you can allocate per account per region (e.g., 5 in AWS). This limit can typically be increased upon request.