Dynamically setting CPU Memory and environment variables to ECSTask Block

I have this deployment:

prefect deployment build jobs/test1/test1.py:test1 \
--name test2 \
--output jobs/test1/deployment \
--storage-block github/yuvital-prefect-github \
--work-queue main \
--infra-block ecs-task/staging3

Which uses the block ecs-task/staging3:

I am looking for a way to define different deployments that use the same ecs-task/staging3 block, but “pass” to it different parameters. Something like this:

prefect deployment build jobs/test1/test1.py:test1 \
--name test2 \
--output jobs/test1/deployment \
--storage-block github/yuvital-prefect-github \
--work-queue main \
--infra-block ecs-task/staging3
--CPU 4048 \
--Memory 5000 \
--env-var someKey someValye \

Also, a “lower level” approach which allows me to pass a custom Task Definition would be a nice direction:

prefect deployment build jobs/test1/test1.py:test1 \
--name test2 \
--output jobs/test1/deployment \
--storage-block github/yuvital-prefect-github \
--work-queue main \
--infra-block ecs-task/staging3
--custom-task-defintion "{ 'tags':[ ...]}"

I am also attaching this Slack message as it might be related to the problem:

Thank you for any help on the issue :slight_smile:

Hello Yaron!

You can add your own CPU configuration when you call the ECS function. Additionally, you can include a configuration for your environment variables as well.

For more complex deployment patterns with shared components, I would recommend checking out our newly released projects!

They help simplify the flow development process by allowing users to configure 3 stages:

  • build
  • push
  • pull

@Sahiler Thank you for the information!
But I still don’t sure I get it.
You’ve wrote " include a configuration for your environment variables as well ."

Can you please provide an example of how to define a such variable?
Just to make sure, we are talking about setting it here?

OK (-:
Found it.
To override the CPU and Memory you can just use:

prefect deployment build jobs/test1/test1.py:test1 \
--name test2 \
--output jobs/test1/deployment \
--storage-block github/yuvital-prefect-github \
--work-queue main \
--infra-block ecs-task/staging3 \
--override cpu=256 \
--override memory=512