https://prefect.io logo
Title
v

Vishnu Duggirala

11/17/2022, 4:30 PM
This might be a dumb question, Is it possible to deploy my image as an ECS task without using infrastructure blocks?
a
v

Vishnu Duggirala

11/18/2022, 5:55 PM
Awesome that is what I wanted, but I got this error
botocore.exceptions.NoRegionError: You must specify a region.
I looked at the documentation, there is no attributes "region".
a

Anna Geller

11/18/2022, 8:54 PM
I see what you mean - the ECSTask has
aws_credentials
argument and this is where the region can be defined
v

Vishnu Duggirala

11/21/2022, 5:24 PM
@Anna Geller I'm attempting to run the code without AWS credentials, but with permissions granted via an ECS task role.
a

Anna Geller

11/21/2022, 5:31 PM
Not possible atm afaik
v

Vishnu Duggirala

11/21/2022, 5:49 PM
https://prefect-community.slack.com/archives/CL09KU1K7/p1668443785760059 I was able to execute when I created a block using UI.
This is the error that I'm getting now
a

Anna Geller

11/21/2022, 6:25 PM
Would you like to open a GitHub issue and describe there step by step what you did that led to that error? alternatively try this https://github.com/anna-geller/dataflow-ops
v

Vishnu Duggirala

11/21/2022, 10:17 PM
The problem was that my agent was running an old version.
🙌 1
:gratitude-thank-you: 1
@Anna Geller Can I use a single block to schedule different deployments just by changing the task-def. Example: I have a block "proto" with task-def= "prefect_example" and I want to use same block "proto" to build a deployment with task-def= "hello_world"
ecs_task_block= ECSTask.load("proto")
ecs_task_block.task_definition_arn= "arn:aws:ecs:us-west-2:XXXXXXXXXXX:task-definition/hello_world"
    Deployment.build_from_flow(
        flow= workflow,
        name= "flowtask-test",
        work_queue_name= 'proto',
        infra_overrides= {"env":{"WORKING_DAYS":"6"}},
        infrastructure= ecs_task_block,
        path= "/app",
        apply= True
    )
This is how I have the code right now but agent fails because it is still trying to retrieve the old task-def in that block which is "prefect_example"
a

Anna Geller

11/28/2022, 7:42 PM
you would need to save that block first
ecs_task_block= ECSTask.load("proto")
ecs_task_block.task_definition_arn= "arn:aws:ecs:us-west-2:XXXXXXXXXXX:task-definition/hello_world"
ecs_task_block.save("proto")
v

Vishnu Duggirala

11/28/2022, 7:47 PM
So, we can't have a single block for multiple deployments that have different task-definitions?
a

Anna Geller

11/28/2022, 7:49 PM
you can but you would need to use --infra-overrides flag on build step
best to use CLI: prefect deployment build...
1