IP Addresses on EC2
Every EC2 instance has two IP addresses - the real one on its
eth0 interface (typically in the 10.0.0.0/8 network), and an external Internet-accessible address. The Amazon using NAT to foward all traffic to the external address to the internal one, and back again for outgoing connections.
Both addresses are dynamically assigned when a system is created. Because an EC2 instance may need to be destroyed and re-created, there is no guarantee that a replacement instance will get the same IP address that a previous system did, even one under the same account.
However, Amazon does allow EC2 accounts to request static IP addresses, which they call Elastic IPs. Each static IP can be associated with a single EC2 instance at a time, and can be moved between instances. This allows you to keep your external addresses consistent in the face of virtual system creation and deletion.
Creating and Managing Static Addresses
To request a new static EC2 address, follow these steps :
- Login to Cloudmin, and go to Amazon EC2 -> EC2 Static IP Addresses.
- Select an EC2 account from the menu at the bottom of the page (if you have more than one), and click the Allocate New Address button.
- If all goes well, the new IP will show up in the list on the same page.
Amazon bills for each static IP address associated with your access, so don't request too many of them!
To give back an address, check the box next to it and click the Return Selected IP Addresses button. Be careful doing this, as you will not be able to request the same address again. Only addresses not assigned to any system can be returned.
Assigning a Static Address
Once an address has been requested, you can assign it to an EC2 system as follows :
- Select the system from the left menu, and go to System Operations -> Assign EC2 Address.
- Select the address from the IP address to assign menu, and click Update IP Address.
- Wait for Cloudmin to detect that the new address has been applied. This may take several minutes.
You can also dis-associate an address from a system on the same page, by selecting <None> from the IP address to assign menu.