| Did this page help you? Yes No Tell us about it... |
Topics
This section applies to you only if you add an Internet gateway to your VPC and want one or more of your VPC instances to directly communicate with the Internet (including a NAT instance).
Each VPC instance has only a private IP address, so if you want an instance to communicate with the Internet, you must allocate an Elastic IP address for use with Amazon VPC and then assign that address to the instance. The address is a static, public IP address that you can assign to any instance in your VPC. With an Elastic IP address, you can mask an instance failure by rapidly reassigning the address to another instance in your VPC.
![]() | Important |
|---|---|
If you're already an EC2 user, you might be familiar with elastic IP addresses. The Elastic IP addresses you use with instances outside your VPC (i.e., EC2 addresses) are not available to use in your VPC. You must allocate a separate set of addresses to use in your VPC (i.e., VPC addresses). The two types of addresses differ in their characteristics (see Differences Between EC2 Addresses and VPC Addresses). You have a separate limit on the number of EC2 addresses and VPC addresses you can have (5 of each type). To request to increase your VPC Elastic IP address limit, submit the Amazon VPC Limits form. |
Following are the basic things you need to know about VPC Elastic IP addresses:
Any instance that needs to communicate with the Internet (i.e., over the Internet gateway) must have an Elastic IP address associated with it.
You first allocate an Elastic IP address for your VPCs, and then assign it to an instance in your VPC (it can be assigned to only one instance at a time).
Elastic IP addresses you use in a VPC are different from ones you use outside a VPC (for a list of the differences, see the next section).
You can move an Elastic IP address from one instance to another in the same VPC, or in any other VPCs that you are running, but not to instances outside the VPC.
Any addresses you've allocated to your VPC remain with your VPC until you explicitly release them.
To ensure you're efficiently using Elastic IP addresses, we impose a small hourly charge when these addresses aren't assigned to an instance (they're free of charge when assigned). You can associate an Elastic IP address to an elastic network interface (ENI), however, if that ENI is not attached to an instance, you’ll be charged for the elastic IP address.
You're limited to 5 VPC Elastic IP addresses; to help conserve them, you can use a NAT instance (see NAT Instances).
The following table lists the differences between EC2 Elastic IP addresses and those you can use in a VPC.
| EC2 | VPC |
|---|---|
|
When you allocate an address, it's associated with your AWS account, but for use only outside a VPC. |
When you allocate an address, it's associated with your AWS account, but for use only in a VPC. |
|
If you try to associate an address that's already associated with another instance, the address is automatically associated with the new instance. |
If you try to associate an address that's already associated with another instance, the request fails. |
|
If you stop an instance, its Elastic IP address is unmapped and you must remap it when you restart the instance. |
If you stop an instance, its Elastic IP address stays mapped. |
Some of the scenarios presented earlier in this guide include instructions for allocating and associating an Elastic IP address. For more information, see Task 8: Allocate and Assign Elastic IP Addresses in scenario 2.
You might want to disassociate an Elastic IP address from the instance it's associated with.
To disassociate an Elastic IP address
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
In the Navigation pane, click Elastic IPs.
Select the address and click Disassociate Address.
The address is disassociated. You can now either release it or associate it with a different instance in your VPC.
To change which instance an Elastic IP address is associated with, you just disassociate the address from the original instance, and then associate the address with the new instance. The instance must be in your VPC.
If you no longer need an Elastic IP address, we recommend you release it (the address must not be associated with an instance). You incur charges for any address that is allocated for use with Amazon VPC but not associated with an instance.
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
In the Navigation pane, click Elastic IPs.
Select the address and click Release Address.
The following table summarizes the available Elastic IP address commands and corresponding API actions. For more information about the commands, go to the Amazon Elastic Compute Cloud Command Line Reference. For more information about the API actions, go to the Amazon Elastic Compute Cloud API Reference.
![]() | Important |
|---|---|
You use the same set of commands and actions for both EC2 elastic IP addresses and VPC addresses. |
| Command and API Action | Description |
|---|---|
|
|
Acquires an Elastic IP address for use with Amazon VPC. |
|
|
Associates an Elastic IP address with an instance in your VPC. |
|
|
Lists your Elastic IP addresses (both EC2 addresses and VPC addresses). |
|
|
Disassociates an Elastic IP address from the instance it's associated with. |
|
|
Releases an Elastic IP address from your AWS account. After releasing an Elastic IP address, it is released to the IP address pool and might no longer be available to you. |