Courseiva
Design for New SolutionshardMultiple ChoiceObjective-mapped

SAP-C02 Design for New Solutions Practice Question

A company is building a serverless application using AWS Lambda. The function needs to access a private Amazon RDS MySQL database. The Lambda function and the RDS instance are in the same VPC. What is the correct way to configure the Lambda function to connect to the database?

⚠ Common exam trap

Many exam-takers assume IAM roles or NAT Gateways provide network access, but AWS Lambda requires explicit VPC configuration with subnets and security groups to route traffic to private resources like RDS within the same VPC.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Configure the Lambda function to run in the same VPC, subnets, and security group as the RDS instance.

Lambda functions in a VPC must be configured with the same VPC, subnets, and security group as the RDS instance to establish direct network connectivity. By placing the Lambda function in the same security group, you can allow inbound traffic from the security group itself (self-referencing rule) or explicitly open the database port (e.g., 3306 for MySQL) to the Lambda's security group. This ensures traffic stays within the VPC and does not traverse the internet, meeting security and latency requirements.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Configure the Lambda function to run in the same VPC, subnets, and security group as the RDS instance.

    Why this is correct

    This allows Lambda to connect to RDS over the network. The security group must allow inbound from Lambda's security group.

  • Use a NAT Gateway to allow Lambda to access RDS through the internet.

    Why it's wrong here

    NAT Gateway is for outbound internet, not for inbound to RDS; also adds latency and cost.

  • Assign an IAM role that allows Lambda to access RDS and configure the security group to allow traffic from the Lambda service.

    Why it's wrong here

    IAM controls permissions but does not provide network access; Lambda must be in the VPC.

  • Attach an Elastic Network Interface (ENI) to the Lambda function in the same subnet as the RDS instance.

    Why it's wrong here

    Lambda automatically manages ENIs via VPC configuration; you cannot attach ENIs directly.

Visual reference

192.168.1.0 /24 256 addresses (254 usable) 192.168.1.0 /25 Subnet A 128 addr (126 usable) 192.168.1.128 /25 Subnet B 128 addr (126 usable) Borrowing 1 bit from host portion creates 2 subnets (/25)

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

This SAP-C02 question is part of Courseiva's 1,660-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This SAP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SAP-C02 exam.