Design Secure Architectures
An application on EC2 must initiate connections only to an RDS for PostgreSQL database on its default port. Which outbound rule on the application's security group provides the least-privilege access?
Show the answer
Correct answerB. Allow TCP port 5432 to the database security group
AWhy not this: Allowing all TCP ports grants more access than the PostgreSQL connection requires.
BWhy this is right: This limits outbound connections to the PostgreSQL port and interfaces associated with the database security group.
CWhy not this: TCP port 3306 is the default MySQL port, not the default PostgreSQL port.
DWhy not this: The VPC CIDR permits access to other VPC destinations on port 5432, exceeding the stated requirement.
PostgreSQL uses TCP port 5432 by default, and the database security group narrows the destination to its associated network interfaces. Allowing that port to the entire VPC CIDR permits connections to more destinations than required.