Understanding AWS’s Elastic IPs
by Leo Vegoda
IP addresses are the numerical identifiers used by network interfaces on IP networks. Organizations often run many instances in cloud computing environments. Elastic IP addresses are the unique IPv4 addresses that can be switched among the network interfaces on your AWS instances. Rapidly remapping IP addresses like this can help you keep services up, even when individual instances aren’t available.
Elastic IP addresses are IPv4 addresses that are permanently reserved for your AWS account, so they won’t be used by anyone else when you’re not using them. They are ideal for service addresses. You can put them in the DNS and use them in TLS certificates, while moving them to the cloud instances you want to run live services.
Kinds of IP Addresses
The Elastic IP service is only needed for IPv4 because there is a limited pool. There is no shortage of IPv6, so your VPC (Virtual Private Cloud) can just use IPv6 addresses as you’d use them elsewhere. AWS charges for IPv4 addresses they supply but does not charge for IPv6 addresses.
Cloud computing services use three main kinds of IPv4 addresses.
Private Addresses
The first is private addresses, which are only locally unique. That means network interfaces using private addresses are not directly accessible over the internet. They are used for communication between instances in the same VPC. They are allocated using DHCP.
Of course, you can connect to them through an intermediate host with a globally unique address. That means, private IP addresses can provide backend services that don’t need full internet access. For instance, a website might use a database with a private IP address. And AWS sells a NAT gateway product, which gives your instances internet access but stops external services initiating a connection with them.
Unique Addresses
The next kind of address is a globally unique address. These come from a pool of dynamically assigned addresses. While you could use these addresses for public services, the address is released back to the pool when the instance stops. There’s no guarantee of getting the same address again.
These addresses cannot be converted to Elastic IP addresses.
Elastic Addresses
AWS’s Elastic IP addresses are statically assigned to your account. You retain them even when they are not in use. This makes them ideal as service addresses. You get five IP addresses by default when enabling Elastic IP addresses. You can request an additional quota if you need more addresses but AWS recommends only using Elastic IP addresses for public services. Inter-instance communications should use DNS names, not IP addresses.
You can use your own IP addresses, through their BYOIP service. If you choose to use your own IP addresses you will need to demonstrate your control of the addresses by creating an RPKI ROA at your RIR. Some holders of legacy IP addresses won’t have access to ROA services. This mostly affects addresses allocated before ARIN was established in 1998.
Pricing and Limitations
As of January 2024, AWS charges $0.005 per IPv4 address per hour, whether attached to a service or not. That’s $43.80 per year. So, if you aren’t using your own addresses, it’s important to be careful with Elastic IP addresses as you’re incurring costs, even if you don’t use the addresses.
If you only need a few resolvable names for public services, Elastic IP is probably a cost-efficient choice. But it is worth noting that the addresses are linked to a service region. You can’t use the same address over multiple regions or move it between regions.
You can connect IPAMs, like ReView to AWS so you can monitor your use of IP addresses and manage costs effectively.
Alternatives
If you need to distribute load over multiple instances, or lambdas, you might need a load balancer. AWS offers servers different load balancer products and these can be a good way to both optimize the number of IPv4 addresses you need and to improve service resilience. The load balancer has a single IPv4 address and passes connections to the resources you place behind it.
Dynamic DNS is sometimes used as an alternative to Elastic IP. When considering it, it’s important to consider more than just cost. AWS notes that it could be a useful approach when you have many instances that aren’t behind a load balancer and you want to use your own DNS names. You can do it with self-managed DNS, or their Route 53 product. But this approach requires a bit more management from you and adds additional complexity.