How Can Lambda Connect Privately to an RDS Instance with Least Overhead?
A company uses Amazon RDS to store transactional data. The company runs an RDS DB instance in a private subnet. A developer wrote an AWS Lambda function with default settings to insert, update, or delete data in the DB instance. The developer needs to give the Lambda function the ability to connect to the DB instance privately without using the public internet. Which combination of steps will meet this requirement with the LEAST operational overhead? (Choose two.)
Community Insight
The question tests Lambda VPC attachment and self-referencing security-group access to RDS; the trap is assuming a default Lambda can reach a private DB or that RDS can allow 'Lambda invocations' directly.
Connecting an AWS Lambda function to a private Amazon RDS instance requires VPC placement plus a security-group rule that references the Lambda's own group rather than CIDR ranges. This page establishes why options C and D form the private, lowest-overhead solution for the DEA-C01 scenario.
The most common wrong choice is B: learners assume the RDS security group can allow 'Lambda function invocations' directly, but a default Lambda sits outside the customer VPC and has no security group or private IP for RDS to reference.
Community Discussion (21 comments)
- AWS Lambda supports VPC configurations, allowing you to run Lambda functions within your own VPC. This enables private connectivity between Lambda functions and resources within the VPC, such as RDS DB instances. Reference AWS Lambda documentation on VPC configurations: [AWS Lambda VPC Settings]https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html - AWS security groups provide a flexible and scalable way to control traffic to your instances or resources. By attaching the same security group to both the Lambda function and the RDS DB instance, you can ensure they share the same set of rules for inbound and outbound traffic. - Self-referencing rules within security groups enable instances within the same security group to communicate with each other over specified ports. - Reference AWS documentation on security groups and self-referencing rules: [Security Groups for Your VPC]https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
C and D are the two required steps: a default Lambda runs in an AWS-managed VPC, not the customer VPC, so it cannot reach the private RDS address without VPC attachment. Configuring Lambda to run in the RDS instance's subnet places an elastic network interface in that private network, giving the function a private path to the database. Attaching the same security group to both resources and adding a self-referencing rule on the database port allows Lambda-to-RDS traffic without hard-coded CIDR ranges or separate group maintenance. Using the same subnet is sufficient here; a different private subnet in the same VPC with routing would also work, but C is the provided option that establishes VPC placement.Why the Other Options Are Wrong
A turns on public access for the DB instance, which directly violates the requirement to avoid the public internet and exposes the database to broader network reachability. B is invalid and insufficient because security groups do not support a rule for 'Lambda function invocations'; a default Lambda has no group to reference, and limiting access to Lambda alone would also break other legitimate DB clients. E is wrong because network ACLs are stateless, CIDR-based filters and do not support self-referencing rules keyed to a security group. Only the combination of VPC attachment in C and the shared self-referencing security group in D closes the private-connectivity loop with minimal overhead.Community Comment Notes
Alagong rejected B because it "does not facilitate a private connection" for a Lambda function outside the VPC. arvehisa favored D because reusing the security group has less operational overhead, and tgv noted that B is "not correctly phrased" for the inbound rule that is actually needed. certplan summarized the C/D rationale as same-network placement plus a self-referencing security group, while altonh raised a minority concern that sharing a DB security group is bad practice. The comments reflect the practical CD consensus, though the verdict here rests on the AWS networking behavior rather than vote count.Official Reference
Exam Strategy
For Lambda-to-private-RDS questions, first ask whether the function is VPC-attached; a default Lambda cannot reach private IP addresses. Then look for a self-referencing security group rule on the database port, which scales without CIDR churn and is the lowest-overhead access pattern.
Frequently Asked Questions
Why is option B not enough to let a default Lambda reach a private RDS instance?
Default Lambda runs outside the VPC, so it has no private IP or security group for RDS to reference. Option B also relies on an invalid Lambda-invocation rule rather than a source security group.
Does option C require Lambda to run in the exact same subnet as the RDS instance?
Option C is sufficient here, but any private subnet in the same VPC with routing to RDS also works. The essential step is attaching Lambda to a VPC subnet that can reach the private RDS endpoint.
Related Analysis
Practice All DEA-C01 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DEA-C01 Practice Test →