How to Access an ECS Fargate Container Using aws ecs execute-command

The aws ecs execute-command command allows you to interactively run shell commands inside a container running in an Amazon ECS cluster. This is useful for debugging, troubleshooting, or performing administrative tasks without redeploying the container.

Use cloud console / terminal to execute the following code –

aws ecs execute-command \
    --cluster rl-staging-cluster \  # ECS cluster name
    --task arn:aws:ecs:eu-west-1:039612877102:task/rl-staging-cluster/d99e9b7a51f04363adb6e3676566d62a \  # Task ARN
    --container strapi-backend \  # Target container
    --command "/bin/sh" \  # Opens a shell session
    --interactive  # Enables interactive mode

1 thought on “How to Access an ECS Fargate Container Using aws ecs execute-command”

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top