0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Amazon ECS デプロイ中のイメージタグバージョン確認方法

Posted at
  • ECSにデプロイ中のコンテナイメージバージョンをわざわざAWSコンソールを開かずに確認したかったため、スクリプトを作成した。メモとして残しておく。

スクリプト

  • check_ecs_image_tag.sh
#!/bin/sh

# AWSリージョン
AWS_REGION="YOUR_AWS_REGION"
# AWsアカウント
AWS_ACCOUNT="YOUR_AWS_ACCOUNT"

# ECS タスクファミリー
TASK_FAMILY_PREFIX_ARRAY=(
    "dev-ecs-app"
    "stg-ecs-app"
)

#aws configure

for tfp in "${TASK_FAMILY_PREFIX_ARRAY[@]}"
do
    currnet_task_version=$(aws ecs list-task-definitions --family-prefix $tfp | jq '.taskDefinitionArns[-1]' | sed -e 's/arn:aws:ecs:`${AWS_REGION}`:`${AWS_ACCOUNT}`:task-definition\///g' | sed 's/''//g')
    echo $tfp`aws ecs describe-task-definition --task-definition $currnet_task_version | jq .taskDefinition.containerDefinitions[0].image`
done

実行結果

sh check_ecs_image_tag.sh
dev-ecs-app "YOUR_AWS_ACCOUNT.dkr.ecr.YOUR_AWS_REGION.amazonaws.com/YOUR_ECS_TASK:image_tag_version"
stg-ecs-app "YOUR_AWS_ACCOUNT.dkr.ecr.YOUR_AWS_REGION.amazonaws.com/YOUR_ECS_TASK:image_tag_version"

参考情報

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?