0 votes
1 view
in AWS by (19.2k points)

How do I use AWS CLI to list all instances with name, state, instance size and AZ in the same line?

I got close with this:

aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==`Name`].Value[], Placement.AvailabilityZone,InstanceType,State.Name]' --output text

But that outputs the instance name below the rest. I want to keep them on the same line so I can copy to a spreadsheet.

1 Answer

0 votes
by (44.6k points)

Use this, it should work:

aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==`Name`].Value[] | [0], Placement.AvailabilityZone,InstanceType,State.Name]' --output text

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


Categories

...