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.
To request a new static EC2 address, follow these steps :
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.
Once an address has been requested, you can assign it to an EC2 system as follows :
You can also dis-associate an address from a system on the same page, by selecting <None> from the IP address to assign menu.