Access ECS tasks with ECS Exec
ECS Exec is a way of using the AWS CLI to launch programs within ECS tasks, including interactive programs like shells.
You’ll need both the AWS CLI, plus the Session Manager plugin.
The Session Manager plugin can be downloaded from AWS or installed using package managers like Homebrew.
This is a general template to launch an interactive shell within a specific task and container:
gds aws ACCOUNT -- aws ecs execute-command --region REGION --cluster CLUSTER --task TASK --container CONTAINER --interactive --command "/bin/sh"
For example, getting a shell within a frontend task in staging would look like:
gds aws govwifi-staging -- aws ecs execute-command --region=eu-west-2 --cluster frontend-fargate --task 180f3f7138704925bcfcecda1996f5b4 --container frontend-radius --interactive --command "/bin/sh"
The specific cluster names, task IDs and container names can be found through the AWS website.