Is it not possible to run ECS tasks with public IP...
# ask-community
m
Is it not possible to run ECS tasks with public IP disabled if the private subnet has a NATGW?
1
m
👋 Anyone ? cc @Darren
1
m
@Anna Geller - don’t know if you’ve encountered this
a
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:
Copy code
"""
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
is this valid in
~1
?
a
nope, it's 2.0
m
we are still on 1
was able to get this working, thank you @Anna Geller
🙌 1