
ECS Fargateでもコマンドが外部から実行できます。
- SSMが実行できるIAM UserのProfileが必要
もくじ
ECS ServiceにECS Execを有効化
aws ecs update-service --profile {IAM User名} \
--cluster {ECS Cluster ARN} \
--service {ECS Service名} \
--propagate-tags TASK_DEFINITION \
--force-new-deployment \
--enable-execute-command
Terraformの場合
resource "aws_ecs_service" "exampl" {
・・・
# ECS Exec有効化
enable_execute_command = true
enable_execute_commandプロパティで有効化できる。
ECS Execでコンテナにログインしコマンド実行
aws ecs execute-command --profile {IAM User名} \
--region ap-northeast-1 \
--cluster {ECS Cluster ARN} \
--task {ECS Task id} \
--container {ECS コンテナ名} \
--interactive \
--command "nginx -t"






