In this guide, we’ll explore how to list public and private IP Addresses of your EC2 instances using the AWS Command Line Interface (CLI). To find the public IP addresses of your EC2 instances with the AWS CLI, run the command aws ec2 describe-instances --query 'Reservations[].Instances[]. [InstanceId, PublicIpAddress]' --output table and it will return a table with a column containing the InstanceID and another column with the attached public IP address.

Once you’ve signed in into your AWS CLI, you can then list the public IP address along with the corresponding instance IDs using the following command: aws ec2 describe-instances --query 'Reservations[*].Instances[*].

Optional: List Private IP Addresses of EC2 Instances Using AWS CLI

Related Articles