An organization is designing a secure two-tier application in a VPC. The application servers reside in a private subnet (Subnet A: ), and the database servers reside in another private subnet (Subnet B: ). A solutions architect must restrict database access so that database instances in Subnet B only receive database traffic on TCP port from Subnet A. The security architecture requires utilizing both Network ACLs (NACLs) and Security Groups to enforce this isolation. Which combination of configuration rules meets these requirements while ensuring the database can successfully respond to the application servers?
- Configure the database security group with an inbound rule allowing TCP port from the application security group. Configure the Subnet B NACL with an inbound rule allowing TCP port from and an outbound rule allowing TCP ports to .Answer
- BConfigure the database security group with an inbound rule allowing TCP port from the application security group and an outbound rule allowing TCP ports to the application security group. Configure the Subnet B NACL with an inbound rule allowing TCP port from .
- CConfigure the database security group with an inbound rule allowing TCP port from the application security group and an outbound rule allowing TCP port to the application security group. Configure the Subnet B NACL with an inbound rule allowing TCP port from and an outbound rule allowing TCP port to .
- DConfigure an AWS WAF web ACL associated with the database subnet to inspect and allow incoming PostgreSQL traffic on TCP port from Subnet A. Configure the database security group with an inbound rule allowing TCP port from the application security group.
Answer
Configure the database security group with an inbound rule allowing TCP port 5432 from the application security group, and configure the Subnet B Network ACL with an inbound rule allowing TCP port 5432 from Subnet A's CIDR block and an outbound rule allowing TCP ports 1024-65535 to Subnet A's CIDR block.
The correct answer combines the stateful nature of security groups with the stateless nature of network ACLs. Because security groups are stateful, allowing inbound TCP port 5432 from the application security group is sufficient to allow bidirectional traffic. In contrast, Network ACLs are stateless, requiring both inbound and outbound rules. The inbound rule must allow TCP port 5432 from the application subnet CIDR block (192.168.1.0/24). The outbound rule must allow TCP traffic to the client's ephemeral port range (1024-65535) back to Subnet A's CIDR block.
Step-by-Step Solution
Key Concept
Stateful Security Groups vs Stateless Network ACLs (NACLs) and Ephemeral Ports