https://prefect.io logo
Title
m

Mike Vanbuskirk

09/07/2022, 7:14 PM
Is it not possible to run ECS tasks with public IP disabled if the private subnet has a NATGW?
1
m

Matt Delacour

09/08/2022, 3:39 PM
👋 Anyone ? cc @Darren
1
m

Mike Vanbuskirk

09/08/2022, 3:45 PM
@Anna Geller - don’t know if you’ve encountered this
a

Anna Geller

09/08/2022, 4:29 PM
definitely possible, if something is not working while doing this, you can submit a GitHub issue. It's not very likely that we would tackle it for 1.0, but we are currently in the process of adding ECSTask block to deployments
so it would be best if you could check the code from this PR and try if this is working for you in a private subnet (it should), example:
"""
pip install git+<https://github.com/PrefectHQ/prefect-aws.git@main>
prefect block register -m prefect_aws.ecs
"""
from prefect_aws.ecs import ECSTask, AwsCredentials

aws_credentials_block = AwsCredentials.load("prod")

ecs = ECSTask(
    command=["echo", "hello ECS"],
    aws_credentials=aws_credentials_block,
    image="prefecthq/prefect:2-python3.9",
    cpu="256",
    memory="512",
    stream_output=True,
    configure_cloudwatch_logs=True,
    cluster="prefect",
    vpc_id="your_private_vpc",
    execution_role_arn="arn:aws:iam::1111111111:role/dataflowops_ecs_execution_role",
    task_role_arn="arn:aws:iam::11111111111:role/dataflowops_ecs_execution_role",
    task_start_timeout_seconds=90
)
await ecs.run()
m

Mike Vanbuskirk

09/08/2022, 4:35 PM
is this valid in
~1
?
a

Anna Geller

09/08/2022, 4:43 PM
nope, it's 2.0
m

Mike Vanbuskirk

09/08/2022, 5:00 PM
we are still on 1
was able to get this working, thank you @Anna Geller
🙌 1