Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I want to list the public IP addresses of my EC2 instances using Bash, separated by a delimiter (space or a new-line).

I tried to pipe the output to jq with aws ec2 describe-instances | jq, but can't seem to isolate just the IP addresses.

Can this be done by aws alone, specifying arguments to jq, or something else entirely?

closed

1 Answer

0 votes
by (44.4k points)
selected by
 
Best answer

Use this in the AWS CLI to get the required outputs:

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

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

Browse Categories

...