<@ULVA73B9P> the execution_role_arn and task_defin...
# ask-marvin
t
@Marvin the execution_role_arn and task_definition_arn are already set in the ecs-pool variables tab. do i need to reference them in the prefect.yaml? if so how to reference these variables instead of hardcoding them in the prefect.yaml?
m
thought for 132.2 seconds
Short answer: No—you don’t need to add them to prefect.yaml if they’re already set on the ECS work pool. Prefect 3.x will use the work pool’s variables by default. Only add them to prefect.yaml if you want to override the pool’s values for a specific deployment. Details: - Valid variable names for ECS pools are
execution_role_arn
and
task_definition_arn
(also
task_role_arn
if you need a task role). - Precedence: 1) Work pool defaults (lowest) 2) Deployment
job_variables
in prefect.yaml (override pool) 3) Flow run
job_variables
at runtime (highest) - You cannot “reference” pool variables from within prefect.yaml. To use the pool’s values, just omit those keys from the deployment. Example (inherits from the ECS pool; nothing hardcoded):
Copy code
deployments:
  - name: my-ecs-deployment
    entrypoint: flows/my_flow.py:my_flow
    work_pool:
      name: my-ecs-pool
      # No job_variables here — will use the pool's execution_role_arn and task_definition_arn
If you need to override for this deployment:
Copy code
deployments:
  - name: my-ecs-deployment
    entrypoint: flows/my_flow.py:my_flow
    work_pool:
      name: my-ecs-pool
      job_variables:
        execution_role_arn: "arn:aws:iam::123456789012:role/ecsTaskExecutionRole"
        task_definition_arn: "arn:aws:ecs:us-east-1:123456789012:task-definition/my-task:1"
If you prefer not to hardcode, you can inject via environment variables when building/deploying:
Copy code
deployments:
  - name: my-ecs-deployment
    entrypoint: flows/my_flow.py:my_flow
    work_pool:
      name: my-ecs-pool
      job_variables:
        execution_role_arn: "{{ $EXECUTION_ROLE_ARN }}"
        task_definition_arn: "{{ $TASK_DEFINITION_ARN }}"
Want me to sanity-check your pool’s current variables or your prefect.yaml? Feel free to paste them (with any sensitive bits redacted).