평범한 케이스에서는 ECS Fargate에 접속하지 않는것이 Best Case이지만, ECS Fargate에서 실행 중인 컨테이너에 접속해야하는 경우가 있으므로 작성해보았다.
aws ecs update-service --cluster <cluster-name> --service <service-name> --enable-execute-command
aws ecs update-service --cluster <cluster-name> --service <service-name> --force-new-deployment
2-1. 아래 명령어를 통해 잘 적용이 됐는지 확인한다.
aws ecs describe-tasks --cluster <cluster-name> --tasks <task-arn> | grep enable
위 명령어 결과가 "enableExecuteCommand": true 로 반드시 떠야 대상 task에 접속이 가능하다.
aws ecs execute-command --cluster <cluster-name> --task <task-arn> --container <container-name> --command "/bin/bash" --interactive
예시) aws ecs execute-command --cluster UltimaF --task 838d773b17954bcfbbacf343fb4fea70 --container ultima --interactive --command "/bin/sh"