SAA-C03 Practice Question 13: NACL Ephemeral Ports
AWS Certified Solutions Architect – Associate (SAA-C03) · Test 2 · question 3 of 10
A security engineer replaces the default network ACL on a public subnet with a custom one that contains only two rules besides the default deny: inbound TCP 443 from 0.0.0.0/0 allowed, and outbound TCP 443 to 0.0.0.0/0 allowed. The web servers' security group allows inbound TCP 443 from anywhere and has the default allow-all outbound rule.
Right after the change, users on the internet report that HTTPS connections to the site time out. The instances are healthy and the web service is listening on port 443. What will fix the problem?
Show answer and explanation
Answer:
Network ACLs are stateless: return traffic is not automatically allowed, so every flow needs an explicit rule in each direction. A client's request reaches the server on port 443 and passes the inbound rule. The server's response, though, is sent *from* port 443 *to* the client's ephemeral port. The client operating system chooses that port, for example 49152-65535 on modern Windows or 32768-60999 on many Linux kernels. The only outbound rule allows destination port 443, so every response is dropped by the default deny and the connection times out. The fix is an outbound rule that allows the ephemeral range. AWS recommends 1024-65535 to cover all client types, including traffic from Elastic Load Balancing and NAT gateways.
Option A misunderstands security groups. They are stateful, so responses to allowed inbound traffic are always allowed back out, whatever the port. The security group is not what is blocking the traffic.
Option B is redundant for the same reason, and the group's default rule already allows all outbound traffic. Anything you change in the security group leaves the network ACL still blocking the responses.
Option D is the right range in the wrong direction. An inbound ephemeral rule is what you need when the *instance* starts the connection, for example downloading patches from the internet, so that the responses can get back in. For client connections into the web server, the responses leave the subnet, so the missing rule is outbound.
References: Custom network ACLs for your VPC; Control subnet traffic with network access control lists