
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"

![CET リアルタイム集計・分析基盤 構成メモ[NOINDEX]](https://www.yuulinux.tokyo/contents/wp-content/uploads/2017/11/plan_20181101_0-150x150.png)


![PHP Factory Methodパターン [PHPによるデザインパターン入門]](https://www.yuulinux.tokyo/contents/wp-content/uploads/2017/09/phpDP_20190407_1-150x150.jpg)

![[MySQL] rangeが絡むバッチサイズの計算](https://www.yuulinux.tokyo/contents/wp-content/uploads/2020/04/mysql_logo-150x150.jpg)