How does amazon assign public IP address to its EC2 instance?

As this IP address is public means I can use it from anywhere and it is reachable from the internet which means that it is unique worldwide. As I read from the news that North America has exhausted all IPV4 addresses then how Amazon is still able to assign public IPV4 addresses to clients?

  • ARIN pool is depleted. Companies acquire ARIN blocks beforehand. Amazon has a large number of IP addresses pre-acquired and will have to cycle these.
    – Sathyajith Bhat
    Oct 20, 2015 at 8:41

1 Answer 1


Amazon Web Services has multiple pools of IPv4 addresses allocated, some of which contain over a million addresses.

See http://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html

There are two ways to get a public IP address for an EC2 instance: from the dynamic pool and from the elastic pool.

Elastic IP addresses are associated with the AWS account. You are free to associate then with any instance, and to move them from one instance to another, though a nominal charge applies if you remap them more than the allowed number of remaps per month. No charge is levied for each elastic IP, unless you (a) leave it unattached to any instance, (b) bind it to an instance with an Elastic IP address already attached (charges apply for 2nd, 3rd, 4th, etc., on the same instance, but not the 1st). A nominal hourly charge applies to both of these conditions, to encourage efficient use of the available address space. A default limit of 5 Elastic IP addresses per region applies, but the limit will be increased when a request accompanied by an explanation of your use case is sent to AWS support. These addresses are not reclaimed by AWS for use by other customers until the account holder releases them.

The addresses in the dynamic pool are attached to instances where you request that the instance have a public IP address, but not an Elastic IP. One of these addresses is assigned from the pool each time the instance is started. If the instance is terminated, the address is immediately reclaimed to the pool, where it can be reassigned to a different customer at any time. Even if you stop and don't terminate an instance with such an address, the address is immediately reclaimed by the pool. Restarting the instance will cause it to obtain a new public IP from the pool.

Within VPC, any number of instances can use a single public IP from either pool for their outbound Internet access, by binding the IP address to a "NAT instance" (technically Port Address Translation, a subset of NAT), which is an EC2 instance that serves as the default route toward the Internet for instances with only a private IP.

So, a combination of a large number of addresses already on hand, plus policies that encourage efficient use, is how AWS is able to accomplish this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.