LoginSignup
0
0

More than 5 years have passed since last update.

EC2のNameTagの情報を取得する

Last updated at Posted at 2019-02-19

あるEC2でそのEC2自体のNameTagの内容を取得するコマンドです。
aws cliは使えるように事前に設定が必要です。

aws ec2 describe-instances \
--query 'Reservations[].Instances[].{Name:Tags[?Key==`Name`].Value}' \
--filter "Name=instance-id,Values=$(curl 'http://169.254.169.254/latest/meta-data/instance-id')" \
| jq -r .[0].Name[0]
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0