Running commands inside ECS containers2 - alphagov/notifications-manuals GitHub Wiki
Notify App runs on containers deployed on AWS ECS. These are serverless containers running in ecs clusters like this:
https://eu-west-1.console.aws.amazon.com/ecs/v2/clusters/notify/services?region=eu-west-1
Sometimes it is necessary/desired to go into a running container for debugging purpose.
To run commands directly inside a container, it must be configured to accept such connections.
you can connect to your container by running the following command:
gds aws <aws-environment> \
-- aws ecs execute-command \
--cluster <cluster-name> \
--task <task-id> \
--container <container-name> \
--interactive \
--command "/bin/sh"
Hopefully you will get connected to the container
If you cannot get connected a good first step is to analyse if the setup in your machine and the container is done
There is a useful tool called Amazon ECS Exec Checker that allows you to check and validate if your ECS service/task is already able to run ECS Exec
$ session-manager-plugin
The Session Manager plugin was installed successfully. Use the AWS CLI to start a session.