Skip to main content

02. IP Addresses in AWS

AWS uses both IPv4 and IPv6 addressing schemes. These addresses determine whether your resources are reachable from the internet or stay private within your VPC.


1️⃣ IPv4 in AWS

TypeDescriptionBehaviorExampleCost
Public IPv4Used to connect to the internet.Assigned automatically to EC2 instances. Released on stop, new one on restart.3.120.45.22Free
Private IPv4Used within a private VPC network.Persistent for the lifetime of the instance. Not reachable from the internet.192.168.1.1Free

📝 Note:
If you stop and start your EC2 instance, the public IPv4 changes, but the private IPv4 remains the same.


2️⃣ Elastic IP (EIP)

FeatureDescription
PurposeProvides a fixed public IPv4 address.
PersistenceRemains the same even if the instance is stopped and started.
Use CaseNeeded when a static IP is required (e.g., DNS mapping, firewall rules).
PricingCharged if not actively associated with a running instance.

3️⃣ IPv6 in AWS

PropertyDetails
ProtocolIPv6 (Internet Protocol version 6)
Address Space3.4 × 10³⁸ addresses (virtually unlimited)
Format Example2600:1f18:abcd:1234::1
AccessibilityAll IPv6 addresses are public (no private ranges)
CostFree in AWS

💡 Tip:
Use IPv6 to expose your applications publicly without incurring IPv4 costs.


🧩 Summary

ConceptIPv4IPv6
Address TypePublic & PrivatePublic only
Cost$0.005/hour(Elastic)Free
PersistencePublic IP changes on restartPermanent
Use CaseLegacy & compatibilityModern, scalable networking