A startup is deploying a microservices application using Amazon ECS with the Amazon EC2 launch type. The tasks run on EC2 instances managed by an Auto Scaling group (ASG) in private subnets. The application uses dynamic port mapping, where the container's port is mapped to a dynamically allocated host port in the range on the EC2 instances. An Application Load Balancer (ALB) in the public subnets routes external traffic from port to the target group associated with the ECS service.
The security team has configured custom Network ACLs (NACLs) and Security Groups to enforce strict traffic filtering:
1. Public Subnet NACL:
- Inbound: Allows TCP port from 0.0.0.0/0.
- Outbound: Allows all traffic.
2. Private Subnet NACL:
- Inbound: Allows TCP port and ephemeral ports from the public subnets.
- Outbound: Allows all traffic.
3. EC2 Instance Security Group:
- Inbound: Allows TCP port from the ALB security group.
- Outbound: Allows all traffic.
The target group has its health check port configured to traffic-port. The ECS tasks fail to register successfully because the ALB marks the targets as unhealthy, causing the ASG to terminate and relaunch the EC2 instances.
Which action should the solutions architect take to resolve this issue and allow the health checks to pass?
- AModify the target group health check configuration to use HTTP port instead of the default traffic-port.
- BConfigure the private subnet Network ACL to allow stateful return traffic on ports from the ALB.
- Update the security group of the EC2 instances to allow inbound TCP traffic on the dynamic port range from the ALB security group.Answer
- DCreate an Amazon Route 53 Latency routing policy to route traffic directly to the private IP addresses of the EC2 instances.