0 votes
1 view
in AWS by (19.2k 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?

1 Answer

0 votes
by (44.6k 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

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...