ec2-describe-instance-status
always returns all columns specified in documentation
I need a way to know just the state name
and state code
of the instance of instance.
Is there a way to do so ?
ec2-describe-instance-status
always returns all columns specified in documentation
I need a way to know just the state name
and state code
of the instance of instance.
Is there a way to do so ?
These days, it's best to use the [aws-cli][1]
:
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,State.Name,State.Code]' --output text
i-38b3ef47 stopped 80
i-28afe386 stopped 80
i-9da318a2 stopped 80
i-3c5ac651 stopped 80
i-4f45ec91 running 16
i-6d231640 stopped 80
ec2-describe-instance-status | grep '^INSTANCE\s' | cut -f2,4,5