Ravish Mallya
09/06/2025, 4:56 AMMarvin
09/06/2025, 4:56 AMMarvin
09/06/2025, 5:02 AMtask_definition_arn
in the ECS work pool’s Base Job Template instead of the deployment’s job variables.
- Then when the task definition changes, just update the work pool — no code changes or CI/CD redeploys needed.
- UI path: Work Pools -> your ECS pool -> Edit Base Job Template -> update “Task definition ARN”.
- Docs: Customize job variables
2) Don’t pin an ARN — let the worker register the task definition
- If you omit task_definition_arn
, the ECS worker will use the work pool’s job variables (image, cpu, memory, roles, env, network) to register a task definition on demand.
- This makes Prefect the source of truth for the TD config so you don’t need to sync with an external AWS-managed TD.
- Docs: ECS guide
3) Use a dynamic value via Jinja and update it externally
- Set task_definition_arn
in the Base Job Template to read from an environment variable or Prefect Variable:
- Example in your Base Job Template:
{
"task_definition_arn": "{{ env.get('ECS_TASK_DEFINITION_ARN') }}"
}
or
{
"task_definition_arn": "{{ variables.get('ECS_TASK_DEFINITION_ARN') }}"
}
- When a new TD is published in AWS, update the env var on the worker or the Prefect Variable (you can automate this with a short script using boto3). No redeploy required.
- Docs: Customize job variables
Notes on “latest” by family
- ECS RunTask supports passing a family name to use the latest ACTIVE revision. Prefect’s field is named task_definition_arn
, and we haven’t found official docs guaranteeing that a family name (e.g., my-family
) will be passed through unchanged. If you want to try this, I can help you test it — but the supported approaches above are safer.
If you tell me which direction you prefer (work pool as the single place to update, Prefect-managed TDs, or a dynamic value), I can share exact steps/snippets tailored to your current setup.