1
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 3 years have passed since last update.

Fargateにsshできるワンライナー

Posted at

xargs -a <(aws ecs list-tasks --cluster=[your cluster name] --service-name=[your service name] | jq '.taskArns[0] | split("/")[2]') -I{} aws ecs execute-command --cluster [your cluster name] --task {} --container [your container name] --interactive --command '/bin/sh'

list-tasksで取得できる一番古いfargateタスク内の特定のコンテナにsshできます。
最初はlist-tasksの結果をパイプでxargsに渡していましたがこれだと Cannot perform start session: EOF となり失敗するはずです。

参考にした記事: https://stackoverflow.com/questions/30044927/xargs-exec-command-with-prompt

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?