A company is deploying an application on Amazon EC2 instances in a private subnet (CIDR: ) of a VPC. The application must securely query a PostgreSQL database ( port ) hosted by a partner vendor. The partner has exposed their database service using an AWS PrivateLink VPC endpoint service. A solutions architect creates an Interface VPC endpoint in the private subnet to connect to the partner service. Which configuration of security groups will allow the application to query the database while maintaining the principle of least privilege?
- AAssociate a security group with the EC2 instances that allows outbound TCP traffic on port to the CIDR of the private subnet. Associate a security group with the Interface VPC endpoint that allows inbound TCP traffic on port from .
- BAssociate a security group with the EC2 instances that allows outbound TCP traffic on port to the security group of the Interface VPC endpoint, and inbound TCP traffic on port from the Interface VPC endpoint. Associate a security group with the Interface VPC endpoint that allows inbound and outbound TCP traffic on port .
- Associate a security group with the EC2 instances that allows outbound TCP traffic on port to the security group of the Interface VPC endpoint. Associate a security group with the Interface VPC endpoint that allows inbound TCP traffic on port from the security group of the EC2 instances.Cevap
- DConfigure the Network ACL of the private subnet to allow outbound TCP traffic on port to the VPC endpoint and inbound TCP traffic on port from the VPC endpoint. Do not associate security groups with either the EC2 instances or the Interface VPC endpoint.
Cevap
Associate a security group with the EC2 instances that allows outbound TCP traffic on port to the security group of the Interface VPC endpoint. Associate a security group with the Interface VPC endpoint that allows inbound TCP traffic on port from the security group of the EC2 instances.
The correct option establishes the most secure, least-privilege connection by allowing outbound traffic from the EC2 instances specifically to the VPC endpoint's security group, and inbound traffic to the VPC endpoint specifically from the EC2 instances' security group. Because security groups are stateful, the return traffic does not require additional rules.
Adım Adım Çözüm
Anahtar Kavram
VPC Interface Endpoints and Stateful Security Groups