Anish S
07/16/2025, 3:56 PM@flow that runs in as an ecs task. Marvin bot wasn't helpful. My job variables looks something like follows at the moment. I can see in the codebase they use task_definition and container_definition, but couldn't find appropriate way to where these variables would go.
flow.deploy(
...
, job_variables={
"cpu": 1024*8,
"memory": 2048*8,
"execution_role_arn": arn
"vpc_id": vpc,
"cluster": "prefect-worker", # FIXME
"configure_cloudwatch_logs": True,
"cloudwatch_logs_options": {
"awslogs-create-group": "true",
"awslogs-group": "prefect-worker",
},
"cloudwatch_logs_prefix": "mesh-log",
"network_configuration": {...}
}
)Anish S
07/16/2025, 5:20 PMecs task definitions on the aws side.
"job_variables": {
...,
"task_definition": {
"volumes": [
{
"name": "efs-volume",
"efsVolumeConfiguration": {
"fileSystemId": "fs-01c96a434f8895d5e",
"rootDirectory": "/",
}
}
],
"containerDefinitions": [
{
"mountPoints": [
{
"sourceVolume": "efs-volume",
"containerPath": "/app/data/",
"readOnly": False
}
]
}
]
}
}Anish S
07/16/2025, 5:22 PMtask_definition into prefect-aws flow.deploy() function call.Marvin
07/16/2025, 5:22 PMMarvin
07/16/2025, 5:23 PMflow.deploy() function. Instead, you need to:
1. First create and configure your ECS task definition in AWS
2. Use that pre-configured task definition when setting up your ECS infrastructure
The recommended approach is:
1. Create your task definition in AWS (via AWS Console or AWS CLI)
2. Set up your ECS infrastructure with the appropriate roles and permissions
3. Deploy your flow using Prefect's deployment mechanisms
Here's a basic example of how the deployment would look:
python
from prefect import flow
@flow
def my_flow():
# your flow code here
pass
if __name__ == "__main__":
my_flow.deploy(
name="my-aws-flow",
work_pool_name="my-ecs-pool", # Your ECS work pool
# The task definition is configured in the work pool, not here
)
The task definition itself should be configured when you create your ECS work pool in AWS. You can find detailed instructions for setting up ECS infrastructure in the Prefect AWS ECS guide.
Let me know if you'd like more specific information about:
1. Setting up the ECS task definition in AWS
2. Configuring the ECS work pool in Prefect
3. Any other aspects of AWS ECS deployment with Prefect
Also, are you currently using Prefect 2.x or 3.x? This might affect the specific guidance I can provide.Jake Kaplan
07/16/2025, 5:25 PMJake Kaplan
07/16/2025, 5:28 PMAnish S
07/16/2025, 5:35 PMAnish S
07/16/2025, 5:38 PMtrack the changes with git, there's no way? Hard-coding one time seems okay, but if I wanted to recreate the same workpool config again?Jake Kaplan
07/16/2025, 5:42 PMprefect work-pool update <name of workpool> --base-job-template <path/to/file.json>Jake Kaplan
07/16/2025, 5:43 PMAnish S
07/16/2025, 8:18 PM