An application tier deployed on Amazon EC2 instances in Subnet App () must connect to a MongoDB database cluster running on EC2 instances in Subnet DB () on TCP port . Both subnets are associated with custom Network Access Control Lists (NACLs) that currently deny all traffic by default. The associated Security Groups are already configured to allow all required database traffic.
Which two NACL rules must be added to the Subnet DB NACL to successfully allow this database communication? (Select two.)
- An inbound rule that allows TCP traffic on port from source CIDR .Answer
- An outbound rule that allows TCP traffic on ports - to destination CIDR .Answer
- CAn outbound rule that allows TCP traffic on port to destination CIDR .
- DAn inbound rule that allows TCP traffic on ports - from source CIDR .
- EAn inbound rule that allows TCP traffic on port from source CIDR , relying on the security group's stateful tracking to permit the outbound database response.
Answer
To allow the connection, the database subnet's NACL needs an inbound rule allowing TCP traffic on port 27017 from the application subnet, and an outbound rule allowing response traffic on ephemeral ports 1024-65535 back to the application subnet.
The correct configurations are the inbound rule to allow traffic on the database listening port and the outbound rule to allow return traffic on ephemeral ports. Since NACLs are stateless, they require separate rules for both directions. The inbound rule allows the connection request to reach the database, and the outbound rule allows the response to return to the client's ephemeral port range.
Step-by-Step Solution
Key Concept
Stateless nature of Network Access Control Lists (NACLs) and ephemeral port requirements.