aws ecs execute-commandでタスク名を省略

aws ecs execute-command \
  --cluster my-cluster \
  --task $(aws ecs list-tasks --cluster my-cluster --desired-status RUNNING --query "taskArns[0]" --output text) \
  --container php \
  --interactive \
  --command "bash"

クラスター名は頻繁に変わらないのでこのコマンドでタスク名をわざわざコピーしなくていい
$(aws ecs list-tasks –cluster genar-web-cluster –desired-status RUNNING –query “taskArns[0]” –output text)
実行中の最初のタクスを取得する

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA


This site uses Akismet to reduce spam. Learn how your comment data is processed.