Courseiva
Development with AWS ServicesmediumMultiple ChoiceObjective-mapped

DVA-C02 Development with AWS Services Practice Question

A developer is using AWS SAM to deploy a serverless application. The template includes a Lambda function that connects to an RDS MySQL database. The function works correctly in the developer's account but fails with a timeout when deployed to a production account. What is the MOST likely cause?

⚠ Common exam trap

Many exam-takers assume a Lambda function can always reach an RDS database by default, overlooking the critical VPC configuration requirement for private resources.

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

The Lambda function is not attached to the same VPC as the RDS instance.

The most likely cause is that the Lambda function is not attached to the same VPC as the RDS instance. Lambda functions run in a VPC by default only if explicitly configured; without VPC attachment, the function cannot reach the RDS database's private IP address, leading to a connection timeout. The developer's account may have had the RDS instance publicly accessible or the Lambda function was inadvertently in the same VPC, but the production account likely uses a private RDS instance in a VPC that the Lambda function is not connected to.

Answer analysis

Option-by-option breakdown

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

  • The Lambda function timeout is set too low for the database query.

    Why it's wrong here

    While a low Lambda function timeout can certainly cause execution failures, the typical error message for a timeout explicitly indicates that the 'Task timed out after X seconds'. If the problem manifests as an inability to connect to the database, it strongly suggests a network configuration issue rather than an execution duration problem. Increasing the timeout would not resolve a fundamental block preventing the Lambda function from establishing an initial network connection to the Amazon RDS instance.

  • The Lambda function is not attached to the same VPC as the RDS instance.

    Why this is correct

    For a Lambda function to securely and privately access an Amazon RDS instance, it must be configured to operate within the same Virtual Private Cloud (VPC) as the database. RDS instances are typically deployed into private subnets without public internet access, requiring the Lambda function to be placed within that VPC to establish a private network connection. If the Lambda is not attached to the correct VPC, it will be unable to resolve the private IP address or reach the RDS endpoint, leading to connection failures.

  • The SAM template does not support RDS as an event source.

    Why it's wrong here

    AWS SAM (Serverless Application Model) is a robust framework designed to simplify the deployment of serverless applications, and it fully supports integrating Lambda functions with Amazon RDS. While RDS is not a direct event source that triggers Lambda functions, SAM templates allow developers to define the necessary VPC configurations, security groups, and environment variables for a Lambda function to establish a connection to an RDS instance. The issue is not a lack of SAM support, but rather a misconfiguration within the SAM template itself regarding network access.

  • The Lambda function uses a runtime that is not compatible with the MySQL client.

    Why it's wrong here

    Most widely used AWS Lambda runtimes, including Python, Node.js, Java, and .NET, are inherently compatible with MySQL databases. Developers can easily include the appropriate MySQL client libraries (e.g., pymysql for Python, mysql2 for Node.js) within their Lambda deployment package. The runtime itself provides the environment for executing code, and as long as the necessary client libraries are bundled and the connection string is correct, there is no fundamental incompatibility preventing MySQL connectivity.

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

Courseiva writes every DVA-C02 question from scratch — 724 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 DVA-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 DVA-C02 exam.