Skip to content

Instantly share code, notes, and snippets.

@robsonribeiros
Last active October 6, 2025 14:01
Show Gist options
  • Save robsonribeiros/4c1fa5e861a66c4c6716034e524bdcab to your computer and use it in GitHub Desktop.
Save robsonribeiros/4c1fa5e861a66c4c6716034e524bdcab to your computer and use it in GitHub Desktop.

CHECK ENABLED

aws ecs describe-tasks \
  --cluster CLUSTER_NAME \
  --task TASK_ID --query 'tasks[*].enableExecuteCommand' | jq

ENABLE EXECUTE COMMAND

aws ecs update-service \
  --cluster CLUSTER_NAME \
  --service SERVICE_NAME \
  --enable-execute-command

FORCE NEW DEPLOYMENT

aws ecs update-service \
  --cluster CLUSTER_NAME \
  --service SERVICE_NAME \
  --force-new-deployment

CONNECT TO CONTAINER

aws ecs execute-command \
  --cluster CLUSTER_NAME \
  --task TASK_ID \
  --container CONTAINER_NAME \
  --interactive \
  --command "/bin/sh"

OBS.: THE IAM TASK ROLE, ADD THE PERMISSIONS BELLOW:

"ssmmessages:*",
"ssm:StartSession",
"ssm:SendCommand"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment