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.
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 :)
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 10.0.0.0/24 subnet AWS will reserve:
To get a list of the IP addresses in use from the command line:
Using the
subnet-id
filter allows you to exclude the subnets you're not concerned about.If you want a count just replace
sort
withwc -l
.You can visually see the number of IP's free per subnet in the VPC -> Subnet section of the AWS Console.
References