LoginSignup
0
0

More than 1 year has passed since last update.

AWS - ECS のコンテナに ECS Exec で接続する例

Posted at

準備

もしくは AWS Cloud Shell から試すのが手軽

実行

ecs-cli ps --cluster [ECSのクラスタ名] でサービスの一覧を確認する

ecs-cli ps --cluster ecs-cluster-name

Name                                                    State                Ports                     TaskDefinition            Health
ecs-cluster-name/xxxxxxxxxxxxxxxxxxxxxx/container-name  RUNNING              ***********************   **********                HEALTHY

この表示だと何がどれか分かりづらいが、上の一覧でいうと

  • クラスタ名: ecs-cluster-name
  • タスク名: ecs-cluster-name/xxxxxxxxxxxxxxxxxxxxxx
  • コンテナ名 container-name

という対応。

この中のRUNNING のタスクに対してコマンド実行する

例:

aws ecs execute-command --cluster ecs-cluster-name --task ecs-cluster-name/xxxxxxxxxxxxxxxxxxxxxx --container container-name --interactive --command "/bin/sh"

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

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