AWS: Understanding Private IP, Public IP and Elastic IP

Jitendra Bigtani
3 min readAug 10, 2019

--

Encouraged by the feedback on my last week’s article on AWS Networking Made Simple, I am writing this one to explain another important but confusing concept. I will explain the different types of IPs available in AWS and the differences between them. This time, I will use a different analogy though.

What is an IP?

An IP address is a way to uniquely identify a network resource to establish connection.

Example of an IP Address: 172.16.254.1

How do you identify and reach out to a human being? Definitely Name but there are other ways too. For example: Mobile number, Aadhaar Number / Social Security Number, email address etc. One person can have many names like nicknames or pet names etc. Similarly IP addresses are ways to uniquely identify a network resource like computer, printer etc and using which you are able to establish a connection with them.

Person Identifiers

Challenges

Similar to human beings, network resources have many identities (IP addresses). Public IP and Private IP have been traditionally used and AWS added another concept called Elastic IP. Since all of them are in the same format, looking at these addresses it’s difficult and sometimes impossible to determine what type it is. Let’s understand it one by one.

Private IP: This is like your nickname. You are recognized by it within your private circles i.e. your family and friend circle. Probably nobody would identify you in public using your nickname. Typically nick names have a pattern like its very short. For example: Chunnu, Munnu, Kuhu etc. Every person gets some nickname on birth.

Similarly, Private IP is used to identify network resources within a private network. Using Private IP of a network resource, you can’t identify it over internet. There are some IPs dedicated for use as a private IP. These are called RFC 1918 addresses. It is best to use Private IP from these addresses however its not a strict requirement. In AWS, this is the most used among three IP address types and required during creation of VPC, Subnet etc. This is also by default assigned to every instance on creation.

RFC 1918 Private non routable addresses

Public IP: This is like your mobile number. People all over the world can identify and reach out to you using it. Though it has wider reach unlike nick name it is temporary and there is no guarantee you will have the same number tomorrow. Same mobile number can be allocated to other person once surrendered and you can also choose to have another mobile number at any time.

Public IP is a routable address over internet. AWS EC2 instances can be assigned public address if you choose the option but it is dynamic. That means AWS assigns any public IP which makes your instance accessible over the internet. Every time there is a Stop and Start, your instance gets a different Public IP. It’s like you start everyday with a new mobile number. On the other hand, if you restart your instance you still get to keep the same Public IP. Restart is more like a power nap during the day where you get to keep the same mobile number. You can get details of complete AWS Public IP range here.

Elastic IP: This is like Aadhaar number or Social Security Number (SSN). It is meant to uniquely and permanently identify you during your lifetime and does not change. As mentioned earlier, Public IP is dynamic which is a problem. Imagine how difficult life would be if you change your mobile number every day. To solve this problem, AWS allows you to select an Elastic IP which is actually a static Public IP address. Once you attach it to an EC2 instance, it will not change on Instance stop and start.

I hope you have enjoyed reading the article.

--

--