DVA-C02 Development with AWS Services Practice Question
A REST API requires request validation before invoking Lambda to reduce unnecessary function executions for malformed payloads. Where should validation be configured?
⚠ Common exam trap
Many candidates confuse Lambda's execution role or timeout settings with request validation, not realizing that API Gateway is the correct layer to filter malformed payloads before they trigger Lambda.
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
✓
In API Gateway request models and validators
API Gateway provides built-in request validation using models (JSON Schema) and validators. By configuring validation at the API Gateway layer, malformed payloads are rejected before they reach the Lambda function, reducing unnecessary invocations and associated costs. This is the correct approach because API Gateway acts as the entry point for REST APIs and can enforce payload structure without invoking the backend.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Inside the Lambda timeout setting
Why it's wrong here
The Lambda timeout setting dictates the maximum duration a Lambda function is allowed to execute once it has been invoked. This setting does not perform any pre-invocation validation of the incoming request's structure or content. Therefore, it cannot prevent an invalid request from reaching the Lambda function or trigger an error response before the function starts processing.
- ✗
In the IAM execution role
Why it's wrong here
An IAM execution role defines the permissions that a Lambda function assumes to interact with other AWS services, such as reading from S3 or writing to DynamoDB. While essential for authorizing the Lambda function's actions, this role has no mechanism to inspect or validate the payload, headers, or query parameters of an incoming API request. Its purpose is solely for granting service-level access, not for request data validation.
- ✗
In the S3 bucket policy
Why it's wrong here
An S3 bucket policy is used to manage access permissions for an Amazon S3 bucket and its objects, specifying which AWS accounts or IAM users can perform actions like uploading, downloading, or deleting files. This policy is entirely isolated from the API Gateway request lifecycle and Lambda invocation process. It provides no functionality for validating the format or content of API requests before they are routed to a backend service.
- ✓
In API Gateway request models and validators
Why this is correct
API Gateway provides built-in request validation capabilities through the use of request models and validators. Developers can define JSON Schema models for the request body, headers, and query parameters. When enabled for a specific API method, API Gateway automatically validates incoming requests against these defined models *before* invoking the backend integration, such as a Lambda function, returning a 400 Bad Request error for invalid payloads.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
About these practice questions
This DVA-C02 question is part of Courseiva's 724-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 →
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.