Querying EC2 IPs via AWS CLI

on

I had to get a list for all public IPs mapped to EC2 instances.

First start by connecting to AWS via CLI, then use the following:

 

aws ec2 describe-instances --query "Reservations[*].Instances[*].PublicIpAddress" --output=text

 

aws ec2 describe-instances --query "Reservations[*].Instances[*].PrivateIpAddress" --output=text

 

You will see all public/private IPs listed

Leave a Reply

Your email address will not be published. Required fields are marked *