A developer placed an RDS database in the private subnet of VPC-A. The developer also created a Lambda function in the default VPC that tries to connect to the RDS database but cannot. What is the appropriate way to allow the Lambda function to access the RDS instance?
Choose an answer
Tap an option to check your answer.
Correct answer: Deploy the Lambda function into the same subnet as the RDS instance and ensure the RDS security group allows traffic from the Lambda function..
Why this is the answer
The Lambda function needs to be deployed within the same VPC as the RDS instance to communicate directly with it. By deploying the Lambda function into the same subnet (or any subnet within VPC-A) as the RDS instance, they can communicate privately. The RDS security group then needs a rule allowing inbound traffic on the database port (e.g., 3306 for MySQL) from the security group associated with the Lambda function. Modifying the RDS security group to allow traffic from all ports from the VPC CIDR block is too permissive and a security risk. Creating a security group for the Lambda function is a good step, but without deploying the Lambda into the correct VPC, it still won't work. An IAM role grants permissions to AWS services, not network connectivity to an RDS instance.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed