Skip to content

AWS CLI list instances #1567

@yomeshk

Description

@yomeshk

Hello,

When I am trying to list instance names in text format it works

aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==Name].Value[]]' --output text

However when I try to list the same as table it returns an error.

aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==Name].Value[]]' --output table
Error - Row should have 1 elements, instead it has 0

My eventual goal is to list all stopped instances with details of instance-id, Name-tag and instance type in a tabular format.

The command I am trying is:
aws ec2 describe-instances --query 'Reservations[].Instances[].[ InstanceId,[Tags[?Key==Name].Value][0][0],State.Name,InstanceType,Placement.AvailabilityZone ]' --output table

Any help would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    closing-soonThis issue will automatically close in 4 days unless further comments are made.guidanceQuestion that needs advice or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions