Amazon Elastic Compute Cloud
User Guide (API Version 2014-06-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Elastic IP Addresses (EIP)

An Elastic IP address (EIP) is a static IP address designed for dynamic cloud computing. With an EIP, you can mask the failure of an instance or software by rapidly remapping the address to another instance in your account. Your EIP is associated with your AWS account, not a particular instance, and it remains associated with your account until you choose to explicitly release it.

There's one pool of EIPs for use with the EC2-Classic platform and another for use with your VPC. You can't associate an EIP that you allocated for use with a VPC with an instance in EC2-Classic, and vice-versa. For more information about EC2-Classic and EC2-VPC, see Supported Platforms.

Elastic IP Addresses in EC2-Classic

By default, we assign each instance in EC2-Classic two IP addresses at launch: a private IP address and a public IP address that is mapped to the private IP address through network address translation (NAT). The public IP address is allocated from the EC2-Classic public IP address pool, and is associated with your instance, not with your AWS account. You cannot reuse a public IP address after it's been disassociated from your instance.

If you use dynamic DNS to map an existing DNS name to a new instance's public IP address, it might take up to 24 hours for the IP address to propagate through the Internet. As a result, new instances might not receive traffic while terminated instances continue to receive requests. To solve this problem, use an EIP.

When you associate an EIP with an instance, the instance's current public IP address is released to the EC2-Classic public IP address pool. If you disassociate an EIP from the instance, the instance is automatically assigned a new public IP address within a few minutes. In addition, stopping the instance also disassociates the EIP from it.

To ensure efficient use of EIPs, we impose a small hourly charge if an EIP is not associated with a running instance. For more information, see Amazon EC2 Pricing.

Elastic IP Addresses in a VPC

We assign each instance in a default VPC two IP addresses at launch: a private IP address and a public IP address that is mapped to the private IP address through network address translation (NAT). The public IP address is allocated from the EC2-VPC public IP address pool, and is associated with your instance, not with your AWS account. You cannot reuse a public IP address after it's been disassociated from your instance.

We assign each instance in a nondefault VPC only a private IP address, unless you specifically request a public IP address during launch, or you modify the subnet's public IP address attribute. To ensure that an instance in a nondefault VPC that has not been assigned a public IP address can communicate with the Internet, you must allocate an Elastic IP address for use with a VPC, and then associate that EIP with the elastic network interface (ENI) attached to the instance.

When you associate an EIP with an instance in a default VPC, or an instance in which you assigned a public IP to the eth0 network interface during launch, its current public IP address is released to the EC2-VPC public IP address pool. If you disassociate an EIP from the instance, the instance is automatically assigned a new public IP address within a few minutes. However, if you have attached a second network interface to the instance, the instance is not automatically assigned a new public IP address; you'll have to associate an EIP with it manually. The EIP remains associated with the instance when you stop it.

To ensure efficient use of EIPs, we impose a small hourly charge if an EIP is not associated with a running instance, or if it is associated with a stopped instance or an unattached network interface. While your instance is running, you are not charged for one EIP associated with the instance, but you are charged for any additional EIPs associated with the instance. For more information, see Amazon EC2 Pricing.

For information about using an EIP with an instance in a VPC, see Elastic IP Addresses in the Amazon Virtual Private Cloud User Guide.

Differences Between EC2-Classic and EC2-VPC

The following table lists the differences between EIPs on EC2-Classic and EC2-VPC.

CharacteristicEC2-ClassicEC2-VPC

Allocation

When you allocate an EIP, it's for use only in EC2-Classic.

When you allocate an EIP, it's for use only in a VPC.

Association

You associate an EIP with an instance.

An EIP is a property of an elastic network interface (ENI). You can associate an EIP with an instance by updating the ENI attached to the instance. For more information, see Elastic Network Interfaces (ENI).

Reassociation

If you try to associate an EIP that's already associated with another instance, the address is automatically associated with the new instance.

If you try to associate an EIP that's already associated with another instance, it succeeds only if you allowed reassociation.

Instance stop

If you stop an instance, its EIP is disassociated, and you must re-associate the EIP when you restart the instance.

If you stop an instance, its EIP remains associated.

Multiple IP

Instances support only a single private IP address and a corresponding EIP.

Instances support multiple IP addresses, and each one can have a corresponding EIP. For more information, see Multiple Private IP Addresses.

Allocating an Elastic IP Address

You can allocate an Elastic IP address using the AWS Management Console or the command line.

To allocate an Elastic IP address for use with EC2-Classic using the console

  1. Open the Amazon EC2 console.

  2. Click Elastic IPs in the navigation pane.

  3. Click Allocate New Address.

  4. Select EC2 from the EIP list, and then click Yes, Allocate. Close the confirmation dialog box.

To allocate an Elastic IP address using the command line

You can use one of the following commands. For more information about these command line interfaces, see Accessing Amazon EC2.

Describing Your Elastic IP Addresses

You can describe an Elastic IP address using the AWS Management Console or the command line.

To describe your Elastic IP addresses using the console

  1. Open the Amazon EC2 console.

  2. Click Elastic IPs in the navigation pane.

  3. To filter the displayed list, start typing part of the EIP or the ID of the instance to which it is assigned in the search box.

To describe your Elastic IP addresses using the command line

You can use one of the following commands. For more information about these command line interfaces, see Accessing Amazon EC2.

Associating an Elastic IP Address with a Running Instance

You can associate an Elastic IP address to an instance using the AWS Management Console or the command line.

To associate an Elastic IP address with an instance using the console

  1. Open the Amazon EC2 console.

  2. Click Elastic IPs in the navigation pane.

  3. Select an EIP and click Associate Address.

  4. In the Associate Address dialog box, select the instance from the Instance list box and click Associate.

To associate an Elastic IP address using the command line

You can use one of the following commands. For more information about these command line interfaces, see Accessing Amazon EC2.

Associating an Elastic IP Address with a Different Running Instance

You can reassociate an Elastic IP address using the AWS Management Console or the command line.

To reassociate an Elastic IP address using the console

  1. Open the Amazon EC2 console.

  2. Click Elastic IPs in the navigation pane.

  3. Select the EIP, and then click the Disassociate button.

  4. Click Yes, Disassociate when prompted.

  5. Select the EIP, and then click Associate.

  6. In the Associate Address dialog box, select the new instance from the Instance list, and then click Associate.

To disassociate an Elastic IP address using the command line

You can use one of the following commands. For more information about these command line interfaces, see Accessing Amazon EC2.

To associate an Elastic IP address using the command line

You can use one of the following commands. For more information about these command line interfaces, see Accessing Amazon EC2.

Releasing an Elastic IP Address

If you no longer need an EIP, we recommend that you release it (the address must not be associated with an instance). You incur charges for any EIP that's allocated for use with EC2-Classic but not associated with an instance.

You can release an Elastic IP address using the AWS Management Console or the command line.

To release an Elastic IP address using the console

  1. Open the Amazon EC2 console.

  2. Click Elastic IPs in the navigation pane.

  3. Select the Elastic IP address, click the Release Address button, and then click Yes, Release when prompted.

To release an Elastic IP address using the command line

You can use one of the following commands. For more information about these command line interfaces, see Accessing Amazon EC2.

Using Reverse DNS for Email Applications

If you intend to send email to third parties from an instance, we suggest you provision one or more Elastic IP addresses and provide them to us in the Request to Remove Email Sending Limitations form. AWS works with ISPs and Internet anti-spam organizations (such as Spamhaus) to reduce the chance that your email sent from these addresses will be flagged as spam.

In addition, assigning a static reverse DNS record to your Elastic IP address used to send email can help avoid having email flagged as spam by some anti-spam organizations. You can provide us with a reverse DNS record to associate with your addresses through the aforementioned form. Note that a corresponding forward DNS record (A Record) pointing to your Elastic IP address must exist before we can create your reverse DNS record.

Elastic IP Address Limit

By default, all AWS accounts are limited to 5 EIPs, because public (IPv4) Internet addresses are a scarce public resource. We strongly encourage you to use an EIP primarily for load balancing use cases, and use DNS hostnames for all other inter-node communication.

If you feel your architecture warrants additional EIPs, please complete the Amazon EC2 Elastic IP Address Request Form. We will ask you to describe your use case so that we can understand your need for additional addresses.