An organization runs a fleet of Amazon EC2 instances in a private VPC subnet () that must initiate outbound connections to a third-party payment gateway on the internet on TCP port . The client application on the EC2 instances uses ephemeral ports () as source ports. Outbound traffic is routed through a NAT Gateway located in a public subnet (). Both the private subnet's Network Access Control List (NACL) and the EC2 instances' security group are custom and currently deny all inbound and outbound traffic. Which combination of rule configurations will successfully allow the EC2 instances to establish connections and receive responses from the payment gateway? (Select TWO.)
- In the custom security group, add an outbound rule that allows TCP traffic on port to .Answer
- In the private subnet's custom NACL, add an outbound rule that allows TCP traffic on port to , and an inbound rule that allows TCP traffic on port range from .Answer
- CIn the private subnet's custom NACL, add an outbound rule that allows TCP traffic on port to , and an inbound rule that allows TCP traffic on port from .
- DIn the custom security group, add an outbound rule that allows TCP traffic on port to the private IP address of the NAT Gateway.
- EIn the private subnet's custom NACL, add an inbound rule that allows TCP traffic on port from , and an outbound rule that allows TCP traffic on port range to .
Answer
In the custom security group, add an outbound rule that allows TCP traffic on port to ; and in the private subnet's custom NACL, add an outbound rule that allows TCP traffic on port to , and an inbound rule that allows TCP traffic on port range from .
The correct configuration requires allowing outbound TCP port in the security group to , as security groups are stateful and track the destination IP of the packet. In addition, because NACLs are stateless, the private subnet's NACL must explicitly allow the outbound request on port and the inbound response on the ephemeral port range ().
Step-by-Step Solution
Key Concept
Stateful vs. Stateless network controls in AWS VPC (Security Groups vs. NACLs) and their handling of ephemeral ports.