Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-output.html





Code Block
titleinstance id and instance name ( Tags )
aws ec2 describe-instances --query 'Reservations[].Instances[].[InstanceId, Tags[?Key==`Name`].Value[] | [0]]' --output text --no-verify
C:\Program Files\Amazon\AWSCLI\.\botocore\vendored\requests\packages\urllib3\connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html i-0947d5f8513cff6ed ixVPC-vSRX1 i-0ae9837801fcda4ce ixVPC-Ubuntu1-instance
i-0947d5f8513cff6ed     ixVPC-vSRX1
i-0ae9837801fcda4ce     ixVPC-Ubuntu1-instance

Only InstanceId
----------------
aws ec2 describe-instances --query 'Reservations[].Instances[].[InstanceId]' --output text --no-verify
i-0947d5f8513cff6ed
i-0ae9837801fcda4ce

Only Tags
----------
aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==`Name`].Value[] | [0]]' --output text --no-verify
ixVPC-vSRX1
ixVPC-Ubuntu1-instance



no output: --output text
--------------------------
aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==`Name`].Value[] | [0]]' --no-verify

----------------------------
|     DescribeInstances    |
+--------------------------+
|  ixVPC-vSRX1             |
|  ixVPC-Ubuntu1-instance  |
+--------------------------+