<@ULVA73B9P> currently for ecs deployment, the tas...
# ask-marvin
r
@Marvin currently for ecs deployment, the task_definition_arn is provided as a job variable in deployment yaml. it is possible that this task definition can get frequently updated in aws. So for every new version currently need to update the yaml and commit the change and then let ci-cd redeploy. Is there a way to simplify this?
m
thought for 332.8 seconds
Great question — you don’t need to keep redeploying just to change the ECS task definition ARN. A few ways to simplify this in Prefect 3.x: 1) Move the ARN out of the deployment and into the work pool - Put
task_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:
Copy code
{
  "task_definition_arn": "{{ env.get('ECS_TASK_DEFINITION_ARN') }}"
}
or
Copy code
{
  "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.