Is there any way of seeing what ip addresses AWS thinks have been allocated in a subnet? I've run a ping scan, and I've checked our internal ip management software, and there should be more than 8 ips free, however the Network Load Balancer creation wizard is insisting that I have less than 8 ips free.

It'd be super awesome if I could see what ips amazon thinks we're using, so I can see what the discrepancy is, but I don't see any way of doing that. Anyone know how I could do this? It needs to show all the allocated ips, not just the ones attached to ec2 instances.


Your count may be off because AWS reserves five IP addresses per subnet CIDR block. The first four IP addresses in a subnet CIDR block and the last IP address in that CIDR block for its internal networking.

For example in a subnet AWS will reserve: Network address. Reserved by AWS for the VPC router. Reserved by AWS. The IP address of the DNS server is the base of the VPC network range plus two. For VPCs with multiple CIDR blocks, the IP address of the DNS server is located in the primary CIDR. We also reserve the base of each subnet range plus two for all CIDR blocks in the VPC. For more information, see Amazon DNS server. Reserved by AWS for future use. Network broadcast address. We do not support broadcast in a VPC, therefore we reserve this address.

To get a list of the IP addresses in use from the command line:

aws ec2 describe-network-interfaces --filters Name=subnet-id,Values=<subnet id> |jq -r '.NetworkInterfaces[].PrivateIpAddress' |sort

Using the subnet-id filter allows you to exclude the subnets you're not concerned about.

If you want a count just replace sort with wc -l.

You can visually see the number of IP's free per subnet in the VPC -> Subnet section of the AWS Console.


AWS VPC Subnets

| improve this answer | |

In EC2 console go to Network interfaces view down in the left hand side column. It will show all the network interfaces allocated not only to EC2s but also to Fargate, RDS, VPC Lambdas, NAT Gateways, etc.

Note also that there is a couple of IPs reserved in each VPC and Subnet - IGW, AWS DNS, etc. IIRC it’s the first 5 IPs that are reserved. These will not show in the list above.

Hope that helps :)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.