I'm currently attempting to configure our flow run...
# prefect-aws
k
I'm currently attempting to configure our flow run deployments such that they can override the
ECSTask
infra block by specifying custom values for
cpu
and
memory
. Any help is appreciated!
We use
Deployment.build_from_flow
to create our deployments programmatically: •
flow
is the function that defines the flow logic •
infrastructure
is set to the
ECSTask
block I'd like to know the most reliable manner (a simple code example) to pass parameters to
Deployment.build_from_flow
(is it
infra_overrides
?) or modify the
ECSTask
block (without changing the default settings on the block). Ideally, I'm hoping for something like
infra_overrides={"cpu": 1024, "memory": 4096}
. Also, I'm curious about whether this would register a new task definition every time the deployment is run.
c
Hi Kelvin - Infra overrides expects a dict , I know specifically for kubernetes jobs you can pass an list called customizations with the resource parameters - I’d need to double check syntax for ECSTask
🎈 1
k
Hey @Christopher Boyd , thanks for the reply! Do let me know about the right syntax!
s
I've been hoping to do this as well.
c
https://prefecthq.github.io/prefect-aws/ecs/
Copy code
Run a task with custom memory and CPU requirements


ECSTask(command=["echo", "hello world"], memory=4096, cpu=2048)
Alternatively:
Copy code
Run a task with custom VPC subnets


ECSTask(
    command=["echo", "hello world"],
    task_customizations=[
        {
            "op": "add",
            "path": "/networkConfiguration/awsvpcConfiguration/subnets",
            "value": ["subnet-80b6fbcd", "subnet-42a6fdgd"],
        },
    ]
)
task customizations accept a json patch, which you can treat funcitonally the same as you would for a kubernetes resource block
k
Hey @Christopher Boyd Thanks for the reply! Our situation is a bit different. We have an ECS Task definition already and we reference it by its ARN. Could we still apply these
task_customizations
? Also, how would the
task_customizations
look, if we wanted to specify a certain amount for
cpu
/
memory
?