AWS CLI Command Line: How to use "--query" to output multiple source lines

aws ec2 describe-instances --instance-id i-77777777 \
  --query 'Reservations[*].Instances[*].[InstanceId,ImageId,Tags[*]]' \
  --output text

This command will print Instance Id, AMI ID, Key and Value Tags. You can see more examples here: Controlling Command Output from the AWS Command Line Interface


With Windows (cmd.exe, cmder.exe, etc.), one must use double quotes (") instead of single quotes (') around the query string. Otherwise the console simply prints the path in the query and doesn't even generate an error.