IP Addressing in VPCs

With IP Addressing within a VPC we can make services communicate with each other and other resources through the internet.

Public IP Address

Your IPv4 address is fixed and globally-unique. Which means that you'll have to manually restart or reroute if something happens.

Elastic IP Address:

Elastic IP Address

Elastic IP Addresses are only supported for IPv4 address types.

It is a static address, which means that will not change over time and can be trusted to hold that value for as long as its on.

When used, the EC2 instance doesn't need to have a fixed IP, the Elastic IP is mapped to the private instance IPv4 address allowing the EC2 instance to change IPs without changing the public IP Address.

Important to remember that whenever an EC2 instance restarts, it also changes its current IP Address.

Another benefit of using Elastic IP address is that whenever an instance fails, it can remap to other instances, not allowing the service to go down.

Costs

You are charged as long as it is not being used (counter intuitive, I know.)
If it's assigned to an instance, it replaces the Public IPv4 if an instance and have no cost associated.

Difference Between IPv4 and IPv6

CIDR Block Size

Check: CIDR block

IPv4 VPC CIDR Block: size can be from 16 to 28
IPv6 VPC CIDR Block: fixed at 56

IPv4 Subnet CIDR block: From 16 to 28
IPv6 Subnet CIDR block: Fixed at 64

Public and Private Addresses

On IPv4 there's a difference between private and public IP Addresses.
To enable communication with the internet, a public IPv4 address is mapped to to the primary private IPv4 address though a NAT (Network Address Translation)

On IPv6 All IP Addresses are public. The IPv6 address persists when you restart or stop your instance and is released when you terminate the instance

Persistence:

IPv4 Addresses are released whenever you stop, terminate or restart your instance. That means that whenever one of the actions occur, your instance will change IP.

IPv6 Addresses are fixed and only released on instance termination.

Elastic IP Addresses

With IPv4 Elastic IP Address are supported.
With IPv6 Elastic IP Address are NOT supported.

Security

The Ipv6 address is public, however we can control the access using security groups and Network ACL rules or the routing of the subnet.