https://prefect.io logo
Title
b

badasstronaut

11/16/2022, 7:33 PM
Greetings again Prefect Community. I am trying to pass AWS tags to tasks run by Prefect. I am using
prefect_aws
and here’s an example of my ecs.py infra block:
ecs = ECSTask(image='custom-prefect-dask:latest',
              cpu='512',
              memory='2048',
              cluster='arn:aws:ecs:us-east-1:...Cluster',
              execution_role_arn='arn:aws:iam::...Role',
              task_role_arn='arn:aws:iam:...Role',
              task_start_timeout_seconds=300,
              configure_cloudwatch_logs=True,
              launch_type='FARGATE_SPOT',
              vpc_id='vpc-...',
              task_customizations=[dict(op='replace',
                                        path='/tags',
                                        value=[dict(key='TAG_1', value='Prefect'),
                                               dict(key='TAG_2', value='POC')]),
                                   dict(op='replace',
                                        path='/networkConfiguration/awvpcConfiguration/assignPublicIp',
                                        value='DISABLED')],
              env={'PREFECT_API_URL': '<http://prefect.internal>..../api'})
Expected result: The
prefect
task reflects the tags provided in
task_customizations
Actual result: Only the default
<http://prefect.io/|prefect.io/>
tags are generated on the
prefect
task EDIT: This turned out to be due to an outdated version of
prefect-aws
. The code block above works as expected.
1
UPDATE: This turned out to be an issue with an outdated version of
prefect-aws
on my local machine, which obviously runs
ecs.py
.
This is no longer an issue; applying tags works as expected
🙌 1
m

Mason Menges

11/17/2022, 12:48 AM
Glad to hear it got sorted out, I was trying to figure this one out haha
b

badasstronaut

11/17/2022, 12:51 AM
Thanks. I'm trying to reason about how I'd like to handle this. I'm thinking about using buildkite to create the deployments. This will prevent local pip versions from becoming an issue.