From 3cde9c9c903b1e534c3f87f0566687edf95b9aba Mon Sep 17 00:00:00 2001 From: David Christian Date: Wed, 27 Nov 2019 11:16:25 -0800 Subject: [PATCH] Updated SG to include VPC Cide --- python/ecs/fargate-service-with-autoscaling/app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/ecs/fargate-service-with-autoscaling/app.py b/python/ecs/fargate-service-with-autoscaling/app.py index 36e6759c7..70337c3ba 100644 --- a/python/ecs/fargate-service-with-autoscaling/app.py +++ b/python/ecs/fargate-service-with-autoscaling/app.py @@ -31,6 +31,12 @@ def __init__(self, scope: core.Construct, id: str, **kwargs) -> None: } ) + fargate_service.service.connections.security_groups[0].add_ingress_rule( + peer = ec2.Peer.ipv4(vpc.vpc_cidr_block), + connection = ec2.Port.tcp(80), + description="Allow http inbound from VPC" + ) + # Setup AutoScaling policy scaling = fargate_service.service.auto_scale_task_count( max_capacity=2