Guide to AWS Public, Private, and Elastic IPs: Understanding AWS IP Addressing

IP addresses enable communication between resources, instances, and users. Whether you’re building a cloud-based application, managing an EC2 instance, or configuring network infrastructure, it’s essential to understand the types of IP addresses AWS offers: Public, Private, and Elastic Ips.
This blog explores these three types of IPs, their use cases, and best practices for managing them in your AWS environment.
What is a Public IP in AWS?
A Public IP is an address that allows AWS resources to communicate directly with the internet. When you launch an EC2 instance, for example, it can automatically receive a public IP address, enabling it to be accessed over the public Internet.
Key Features:
- They are dynamic, meaning they can change whenever an instance is stopped and restarted.
- They are automatically assigned unless you specify otherwise.
- They allow inbound traffic from the internet and outbound internet communication.
Use Cases:
Web servers: If you’re hosting a website or application that users access over the internet, a public IP is essential.
Publicly accessible APIs: APIs that external users or systems need to access will require public IPs.
Best Practices:
Limit the exposure of public IP addresses to minimize security risks.
Use AWS security groups and Network Access Control Lists (NACLs) to restrict unwanted traffic.
What is a Private IP in AWS?
A Private IP is used for communication between AWS resources within the (VPC). Private IPs allow resources to communicate securely within a closed network without exposing them to the public internet.
NAT Devices and Gateways.
Machines in a private network connect to the internet through NAT devices and internet gateways acting as proxies.
Key Features:
- Private IP addresses are unique within a VPC.
- Resources with private IPs can only communicate within the VPC or through a VPN/Direct Connect for private networks.
- Unlike public IPs, private IP addresses do not change when an instance is stopped and started.
Use Cases
Internal application communication: For services like databases, back-end servers, and other internal resources, private IPs ensure that only internal AWS resources can connect to them.
Secure networking: Resources with private IPs can communicate securely without being exposed to external networks.
Public vs. Private IP: When to Use Each
The key difference between public and private IPs in AWS is their scope and exposure to the internet. Public IPs allow internet traffic, while private IPs restrict communication within the VPC.
What is an Elastic IP in AWS?
An Elastic IP (EIP) is a static public IP address designed to provide a permanent address for your resources in AWS. Unlike public IPs, which are dynamically assigned and can change, Elastic IPs remain constant even when the instance they are attached to is stopped or rebooted.
Key Features:
- Elastic IPs allow you to keep the same IP address even if you stop and start your instance.
- They are particularly useful for services or instances that require a static IP for DNS or continuous communication.
- Elastic IPs are charged if they remain allocated but are not associated with any running resource.
Use Cases
Reassignable IP for failover: Elastic IPs are often used for failover scenarios where the IP needs to be transferred between instances.
Static IP for applications: Services that need a fixed IP address, such as a public-facing service with DNS records.
Demo: How to Allocate and Associate an Elastic IP to an EC2 Instance
Make sure you have one EC2 instance running then navigate to the EC2 Dashboard by selecting EC2 from the services menu.

On the left-hand sidebar, scroll down and click Elastic IPs under the “Network & Security” section.

Click the Allocate Elastic IP address at the top of the page.

Leave the settings as default and click on the Allocate IP button.



Associating Elastic IP: Click on the allocated elastic IP address then click on associate Elastic IP address.

Under resource select Instance, then under Instance select the Instance you want to associate with the Elastic IP address.

You can check the box on reassociate to allow the elastic IP to be reassociated with a different resource if it’s already associated. Then click on the associate button.

Successfully associated, make sure to clean up by disassociating and realising the IP address.

Best Practices:
Only use Elastic IPs, when necessary, as AWS charges for unused EIPs.
Implement monitoring and failover strategies to reassign Elastic IPs when an instance fails.
Consider using an Elastic Load Balancer (ELB) for services requiring high availability rather than using Elastic IPs.
Conclusion
AWS Public, Private, and Elastic IPs each serve specific purposes in cloud networking. Public IPs facilitate internet-facing communication, private IPs provide secure internal networking, and Elastic IPs provide a static, unchanging IP address that can be reassigned to different instances as needed.
Thanks for reading and stay tuned for more. Make sure you clean up.
If you have any questions concerning this article or have an AWS project that requires our assistance, please reach out to us by leaving a comment below or email us at sales@accendnetworks.com.
Thank you!