An application tier is deployed on Amazon EC2 instances in a private subnet with CIDR block . The instances must download software updates from an external repository over HTTPS (port ). The private subnet's route table contains a route pointing to a NAT Gateway located in a public subnet. The Security Group attached to the instances allows outbound TCP traffic on port to , with no inbound rules. The subnet's Network Access Control List (NACL) has an inbound rule allowing TCP traffic on port from , and an outbound rule allowing TCP traffic on port to . However, the instances are unable to establish a connection to the external repository. Which configuration change will resolve this connectivity issue?
- Add an inbound rule to the NACL allowing TCP traffic on ports from .Answer
- BAdd an inbound rule to the Security Group allowing TCP traffic on ports from .
- CAdd an outbound rule to the NACL allowing TCP traffic on ports to .
- DUpdate the private subnet's route table to route directly to the Internet Gateway instead of the NAT Gateway.
Answer
Add an inbound rule to the NACL allowing TCP traffic on ports from .
The correct option is to add an inbound rule to the NACL allowing TCP traffic on ports from . Amazon VPC Network Access Control Lists (NACLs) are stateless. This means that response traffic to allowed outbound requests is not automatically permitted; an explicit inbound rule must allow the traffic back in. When an EC2 instance initiates a connection to an external repository on port , the response traffic is sent from the repository's port to an ephemeral port () on the EC2 instance. Therefore, the inbound NACL must allow traffic on these ephemeral ports.
Step-by-Step Solution
Key Concept
NACLs are stateless and require explicit rules for both inbound request traffic and outbound return traffic (or vice versa), including the ephemeral port range.