https://prefect.io logo
#prefect-community
Title
# prefect-community
s

Slackbot

04/27/2022, 1:32 AM
This message was deleted.
discourse 1
k

Kevin Kho

04/27/2022, 1:34 AM
You need to supply the vpc in your
run_task_kwargs
From another user
Copy code
import boto3
from prefect import Flow
from prefect.run_configs import ECSRun

ecr = boto3.client("ecr", region_name="us-west-2", aws_access_key_id="dummy", aws_secret_access_key="dummy2")

ecs = boto3.client("ecs", region_name="us-west-2", aws_access_key_id="dummy", aws_secret_access_key="dumy2")
flow = Flow("fcc-test")


flow.run_config = ECSRun(task_definition_arn="arn:aws:ecs:us-west-2:NUMBER:task-definition/fcc_experimental_licenses:13", env={"number_of_records":"100000"}, labels=["sandbox"], run_task_kwargs=dict(cluster="Data-Engineering", networkConfiguration={
            'awsvpcConfiguration': {
                'subnets': [
                    'subnet-008132793b9c944a0'
                ],
                'securityGroups': [
                    'sg-01f7c984659e4f3c4',
                ],
                'assignPublicIp': 'ENABLED'
            }
        }))

flow.register(project_name="test")
You can follow that example
can you share your current ECSRun and storage configuration?
this issue explains this more: https://github.com/PrefectHQ/prefect/issues/5379 but you could try using YAML config instead e.g. attached to the agent: https://github.com/anna-geller/packaging-prefect-flows/blob/master/flows/ecs_flows_from_5411_pr/agent_startup_command.bash also, this class looks complicated and gets defined based on env variables that may not necessarily exist in your registration environment (e.g. CI pipeline in your GHA) - can you try just attaching the ECSRun run config directly to your flow, as Kevin showed?
4 Views