Kiran
09/09/2025, 10:03 AMMarvin
09/09/2025, 10:04 AMMarvin
09/09/2025, 10:12 AMRunTask
request. In your Prefect UI, open your ECS work pool and edit the “Task run request template.” You can:
- Add your own tags
- Remove the Prefect-provided tags
- Replace values with your own expressions
If you’d like, share a screenshot of the “Task run request template” from your ECS work pool and I can point out exactly where to tweak the tags for your setup.Kiran
09/09/2025, 10:46 AMMarvin
09/09/2025, 10:46 AMMarvin
09/09/2025, 10:47 AM"tags": "{{ labels }}",
with a proper AWS Tag list. For example:
"task_run_request": {
"tags": [
{"key": "env", "value": "{{ env }}"},
{"key": "owner", "value": "data-platform"},
{"key": "application", "value": "prefect"}
],
"cluster": "{{ cluster }}",
"overrides": {
"cpu": "{{ cpu }}",
"memory": "{{ memory }}",
"taskRoleArn": "{{ task_role_arn }}",
"containerOverrides": [
{
"cpu": "{{ cpu }}",
"name": "{{ container_name }}",
"memory": "{{ memory }}",
"command": "{{ command }}",
"environment": "{{ env }}"
}
]
},
"launchType": "{{ launch_type }}",
"taskDefinition": "{{ task_definition_arn }}",
"enableExecuteCommand": true,
"capacityProviderStrategy": "{{ capacity_provider_strategy }}"
}
Notes:
- AWS ECS expects tags as a list of objects with key
and value
.
- Prefect’s ECS worker already adds its own Prefect metadata tags (e.g., flow run/deployment info), so you only need to add your custom tags here; Prefect’s defaults will still be included.
- You can reference your job variables (like {{ env }}
) in tag values, just like you do elsewhere in the template.
Where to edit this:
- Prefect UI > Work Pools > your ECS pool > Edit “Task run request template”.
- Docs for ECS worker and job templates: ECS guide
- AWS RunTask API (tag format reference): API_RunTask