LoginSignup
1
1

More than 1 year has passed since last update.

ECS Execで実行中のコンテナに乗り込む

Posted at

※こちらはAWS CLIが導入済みの場合に読むドキュメントです。

AWS CLI 用の Session Manager プラグインをインストールする

(オプション) AWS CLI 用の Session Manager プラグインをインストールする

インストールされたか確認するコマンド

$ session-manager-plugin

サーバーに入るときのコマンド

$ aws ecs execute-command \
 --cluster クラスター名 \
 --task タスク名 \
 --container コンテナ名 \
 --interactive \
 --command "bash"

オプションについて

--cluster クラスター名を指定する

--task タスク名を指定(サービスの一覧からタスクタブでタスク名を確認)←乱数みたなやつです!

--container コンテナ名を指定する

— command mac環境は”bash”を指定

コンテナ名の確認方法
タスク定義画面より「コンテナの定義」で確認できる

エラー時

リージョンが設定されていないときのエラー

You must specify a region. You can also configure your region by running "aws configure".

AWS CLIのユーザー設定確認コマンド

# 一括での確認
$ aws configure list
# 単体での確認
$ aws configure get region

環境設定

環境設定コマンド(アクセスキー, シークレットキー, リージョンの設定等)

$ aws configure

環境設定コマンド(一時的)

# リージョン東京を指定
$ export AWS_DEFAULT_REGION=ap-northeast-1

参考記事

1
1
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
1