Owen Boyd
09/03/2025, 1:07 AMMarvin
09/03/2025, 1:07 AMMarvin
09/03/2025, 1:07 AMMarvin
09/03/2025, 1:11 AMenableExecuteCommand: true
at the top level of the job template so the worker passes it to ECS RunTask
Example job template snippet
{
"cluster": "my-ecs-cluster",
"launchType": "FARGATE",
"taskDefinition": "my-task-def:1",
"networkConfiguration": {
"awsvpcConfiguration": {
"subnets": [
"subnet-abc",
"subnet-def"
],
"securityGroups": [
"sg-123"
],
"assignPublicIp": "ENABLED"
}
},
"enableExecuteCommand": true
}
Notes and prerequisites
- ECS Exec is enabled via the RunTask/Service parameter enableExecuteCommand
(it’s not a task definition field).
- Ensure IAM/SSM prerequisites are in place:
- Your task execution role should include permissions for SSM messages (the AWS-managed policy AmazonECSTaskExecutionRolePolicy
covers this).
- The IAM principal you use to run aws ecs execute-command
needs ecs:ExecuteCommand
and SSM session permissions.
- If you’re running tasks under an ECS Service, you can also enable exec on the service:
- aws ecs update-service --cluster <cluster> --service <service> --enable-execute-command
Refs
- Prefect ECS guide
- AWS ECS Exec docs
If you share your current job template, I can suggest exactly where to add the flag.Marvin
09/03/2025, 1:12 AM{
"job_configuration": {
...
"task_run_request": {
...
"enableExecuteCommand": true
}
}
}
Then you can exec into a running flow-run task with the AWS CLI, e.g.:
aws ecs execute-command --cluster <cluster> --task <task_arn> --container <container_name> --command "/bin/bash" --interactive
Docs:
- Prefect 3.x ECS guide (covers ECS work pools, base job templates, and AWS prerequisites)
If you’d like, share your ECS pool’s current Base Job Template and I can point out exactly where to add enableExecuteCommand
.