This might be a dumb question, Is it possible to d...
# prefect-aws
v
This might be a dumb question, Is it possible to deploy my image as an ECS task without using infrastructure blocks?
1
a
v
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
I see what you mean - the ECSTask has
aws_credentials
argument and this is where the region can be defined
v
@Anna Geller I'm attempting to run the code without AWS credentials, but with permissions granted via an ECS task role.
a
Not possible atm afaik
v
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
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
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"
Copy code
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
you would need to save that block first
Copy code
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
So, we can't have a single block for multiple deployments that have different task-definitions?
a
you can but you would need to use --infra-overrides flag on build step
best to use CLI: prefect deployment build...
1