Reputation: 129
how can I use --query and get only few fields
1.) aws ec2 describe-instances --output json --region us-east-1 2.) aws ec2 describe-instances --query 'Reservations[].Instances[].[InstanceId,State.Name,InstanceType,PrivateIpAddress,PublicIpAddress]' --output json --region us-east-1
The command 1 shows all values but the command 2 should null values. What went wrong in command 2
Upvotes: 1
Views: 1489
Reputation: 1063
Corrected the command -
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,State.Name,InstanceType,PrivateIpAddress,PublicIpAddress]'
You missed the * Due to which you got null values.
Upvotes: 1