Closed5

aws cli - ecs tag まとめ

yuucuyuucu

clusterのarnを変数に入れておく。

export CLUSTER_ARN=${TARGET_ARN}
yuucuyuucu

サービス一覧

aws ecs list-services --cluster $CLUSTER_ARN
yuucuyuucu

ecsのサービスへタグをつける場合

aws ecs tag-resource --resource-arn ${TARGET_SERVICE_ARN} --tags key=key1,value=value1 key=key2,value=value2 key=key3,value=value3
yuucuyuucu

↑でつけたタグを取得。

aws ecs list-tags-for-resource --resource-arn ${TARGET_SERVICE_ARN}

レスポンスはこちら

{
    "tags": [
        {
            "key": "key1",
            "value": "value1"
        },
        {
            "key": "key2",
            "value": "value2"
        },
        {
            "key": "key3",
            "value": "value3"
        }
    ]
}
このスクラップは2023/09/10にクローズされました