A company is converting an application backend from EC2 to serverless. The app and an RDS for MySQL instance run in a single VPC, both deployed in private subnets. The company needs Lambda functions to connect to the DB instance. Which approach meets the requirement?
Choose an answer
Tap an option to check your answer.
Correct answer: Create Lambda functions in the VPC and attach the AWSLambdaVPCAccessExecutionRole policy to their execution role. Modify the RDS security group to allow inbound access from the Lambda security group..
Why this is the answer
The correct approach is to create Lambda functions within the VPC because the RDS database is in a private subnet and not publicly accessible. For Lambda functions to access resources inside a VPC, they must be configured with VPC settings (subnets and security groups). The AWSLambdaVPCAccessExecutionRole policy is necessary for Lambda to create and manage the ENIs (Elastic Network Interfaces) required for VPC access. Finally, the RDS security group must be updated to allow inbound traffic from the security group associated with the Lambda function, ensuring network connectivity between the Lambda and the database. The other options are incorrect because: Attaching AWSLambdaBasicExecutionRole is insufficient for VPC access; it lacks the necessary permissions for ENI management. Creating Lambda functions without VPC configuration means they cannot directly access resources in private subnets. VPC endpoints for Lambda are for invoking Lambda functions from a VPC, not for Lambda functions to access resources within a VPC.
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