LoginSignup
1
0

More than 5 years have passed since last update.

shell scriptでEC2インスタンス内から自分についているタグを取得する

Posted at
ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
TAG_VALUE=`aws ec2 describe-tags --filter "{\"Name\":\"resource-id\",\"Values\": [\"$ID\"]}" --query 'Tags[?Key==\`TAG_NAME\`][Value]' --region ap-northeast-1 --output text`

autoscalinggroupのtagを付ける設定で起動直後は取れないことがあるのでwhileとかで回そう

1
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
1
0