Jeff’s Note #
“Unlike generic exam dumps, ADH analyzes this scenario through the lens of a Real-World Lead Developer.”
“For DVA-C02 candidates, the confusion often lies in distinguishing between mock integrations, request validators, gateway responses, and authorizers. In production, this is about knowing exactly when to use mock integrations to unblock frontend teams while backend services are still under development. The DVA-C02 exam tests your understanding of API Gateway’s testing capabilities and the specific configuration syntax—not just high-level concepts. Let’s drill down.”
The Certification Drill (Simulated Question) #
Scenario #
TechFlow Solutions is building a new customer management portal using a serverless architecture. The backend team is developing Lambda functions to handle business logic, but frontend developers need to start UI integration immediately. As the lead developer, you’ve been tasked with exposing API endpoints through Amazon API Gateway that return predictable responses for testing purposes. The marketing team also wants to demonstrate the application’s UI to stakeholders next week, even though the backend won’t be ready.
The Requirement: #
Configure API Gateway to provide immediate, testable API responses without requiring backend implementation, allowing multiple teams to work in parallel.
The Options #
- A) Set up a mock integration request in API Gateway. Configure the method’s integration request and integration response to associate a response with a given status code.
- B) Set up the request validators in the API’s OpenAPI definition file. Import the OpenAPI definitions into API Gateway to test the API.
- C) Set up a gateway response for the API in API Gateway. Configure response headers with hardcoded HTTP status codes and responses.
- D) Set up a request parameter-based Lambda authorizer to control access to the API. Configure the Lambda function with the necessary mapping template.
Correct Answer #
Option A.
Quick Insight: The Developer Velocity Imperative #
For DVA-C02: This question tests your understanding of API Gateway’s mock integration feature—a critical developer tool that enables contract-first API development. The exam expects you to know the difference between mock integrations (returning static responses without backend calls), request validators (input validation), gateway responses (error handling customization), and authorizers (authentication/authorization). Mock integrations specifically use
integration.requestandintegration.responseconfiguration to map status codes to predefined responses.
Content Locked: The Expert Analysis #
You’ve identified the answer. But do you know the implementation details that separate a Junior from a Senior?
The Expert’s Analysis #
Correct Answer #
Option A: Set up a mock integration request in API Gateway. Configure the method’s integration request and integration response to associate a response with a given status code.
The Winning Logic #
Mock integration is the only API Gateway feature designed specifically for returning static responses without invoking backend services.
Why this is the DVA-C02 answer:
- Direct fulfillment of requirements: Mock integrations allow you to define hardcoded response bodies, headers, and status codes directly in the API Gateway console or via CloudFormation/SAM templates.
- Integration Response mapping: You configure the
integration.responseto map specific HTTP status codes (200, 404, 500) to predefined JSON payloads using mapping templates. - Integration Request configuration: The
integration.requestcan be configured withIntegrationType: MOCK, which tells API Gateway to skip backend invocation entirely. - Immediate availability: Once configured, the endpoint is immediately testable—no Lambda functions, no databases, no dependencies.
- Team parallelization: Frontend teams can code against the API contract while backend teams implement services independently.
DVA-C02 Implementation Details:
{
"integrationType": "MOCK",
"requestTemplates": {
"application/json": "{\"statusCode\": 200}"
},
"integrationResponses": [
{
"statusCode": "200",
"responseTemplates": {
"application/json": "{\"customerId\": \"12345\", \"name\": \"John Doe\", \"status\": \"active\"}"
}
}
]
}
The Trap (Distractor Analysis): #
-
Why not Option B (Request Validators)?
- Purpose mismatch: Request validators check incoming request parameters and body against a JSON Schema model—they validate input, they don’t generate responses.
- OpenAPI integration: While OpenAPI definitions can include request validation rules, importing them doesn’t create mock responses; it only enforces validation rules on incoming requests.
- Still requires backend: Even with validators configured, you still need a backend integration (Lambda, HTTP, etc.) to return responses.
- DVA-C02 trap: Candidates confuse validation (checking data format) with mocking (returning fake data).
-
Why not Option C (Gateway Responses)?
- Error-only scope: Gateway responses customize error responses (4xx/5xx) that API Gateway itself generates (auth failures, throttling, missing API keys, malformed requests).
- No business logic responses: You cannot use gateway responses to return successful (2xx) business data responses.
- Not for testing business logic: Gateway responses handle infrastructure-level errors, not application-level data.
- DVA-C02 trap: The mention of “hardcoded HTTP status codes” sounds appealing, but gateway responses are for exception handling, not mock data generation.
-
Why not Option D (Lambda Authorizer)?
- Authorization, not mocking: Lambda authorizers handle authentication/authorization decisions—they return IAM policies that allow or deny access.
- Still requires backend: Even with an authorizer, you need a backend integration to return API responses.
- Mapping templates irrelevant: While authorizers use mapping templates for request transformation, they don’t generate API responses.
- DVA-C02 trap: This is a complete red herring—authorizers are about security, not testing.
The Technical Blueprint #
API Gateway Mock Integration Flow:
// API Gateway Mock Integration Configuration
{
"methodConfig": {
"httpMethod": "GET",
"resourcePath": "/customers/{customerId}",
"integration": {
"type": "MOCK",
"requestTemplates": {
"application/json": "{\"statusCode\": 200}"
},
"integrationResponses": [
{
"statusCode": "200",
"responseTemplates": {
"application/json": "{\"customerId\": \"$input.params('customerId')\", \"name\": \"Mock User\", \"email\": \"[email protected]\", \"status\": \"active\"}"
},
"responseParameters": {
"method.response.header.Content-Type": "'application/json'"
}
},
{
"statusCode": "404",
"selectionPattern": ".*\"statusCode\":404.*",
"responseTemplates": {
"application/json": "{\"error\": \"Customer not found\"}"
}
}
]
},
"methodResponses": [
{
"statusCode": "200",
"responseModels": {
"application/json": "Empty"
}
},
{
"statusCode": "404"
}
]
}
}
CLI Command to Create Mock Integration:
# Create mock integration for GET method
aws apigateway put-integration \
--rest-api-id abc123 \
--resource-id xyz789 \
--http-method GET \
--type MOCK \
--request-templates '{"application/json": "{\"statusCode\": 200}"}' \
--region us-east-1
# Create integration response with mock data
aws apigateway put-integration-response \
--rest-api-id abc123 \
--resource-id xyz789 \
--http-method GET \
--status-code 200 \
--response-templates '{"application/json": "{\"customerId\": \"12345\", \"status\": \"active\"}"}' \
--region us-east-1
The Comparative Analysis #
| Option | API Complexity | Performance | Primary Use Case | DVA-C02 Keyword Trigger |
|---|---|---|---|---|
| A) Mock Integration | Low (no code needed) | Instant (no backend call) | API prototyping, contract testing, frontend development | “test API immediately,” “generate responses,” “no backend yet” |
| B) Request Validators | Medium (requires JSON Schema) | N/A (validation only) | Input validation, preventing malformed requests | “validate request,” “schema enforcement” |
| C) Gateway Responses | Low (template-based) | N/A (error handling only) | Customizing 4xx/5xx error messages | “customize error responses,” “auth failures” |
| D) Lambda Authorizer | High (requires Lambda code) | Medium (adds auth latency) | Authentication/Authorization decisions | “control access,” “custom auth logic” |
DVA-C02 Decision Matrix:
- Need fake data for testing? → Mock Integration (A)
- Need to validate incoming data format? → Request Validators (B)
- Need to customize error messages? → Gateway Responses (C)
- Need custom authentication? → Lambda Authorizer (D)
Real-World Application (Practitioner Insight) #
Exam Rule #
“For the DVA-C02 exam, when you see keywords like ’test API immediately,’ ‘without backend,’ ‘generate responses for testing,’ or ’enable team to start development,’ always select Mock Integration. The exam expects you to know that mock integrations use integration.response to map status codes to static responses.”
Real World #
“In production, we use mock integrations extensively during sprint planning. When the product team finalizes API contracts in Swagger/OpenAPI, we immediately deploy mock endpoints to AWS using SAM templates. This allows our React team to build components against real API Gateway URLs while the backend team writes Lambda business logic in parallel. We’ve reduced integration delays by 2-3 weeks per feature.
However, we also combine this with API Gateway stages—keeping mock integrations in the dev stage while promoting real integrations to prod. One gotcha: remember to update CloudFormation stack parameters when switching from mock to Lambda integrations, or you’ll accidentally deploy mocks to production (yes, we did this once during a midnight deployment).
For OpenAPI-driven development, we use the x-amazon-apigateway-integration extension in our Swagger files:
paths:
/customers/{id}:
get:
x-amazon-apigateway-integration:
type: mock
requestTemplates:
application/json: '{"statusCode": 200}'
responses:
default:
statusCode: 200
responseTemplates:
application/json: '{"id": "$input.params(''id'')", "name": "Test Customer"}'
This approach lets us version-control our mock responses and deploy consistently across environments.”
Stop Guessing, Start Mastering #
Disclaimer
This is a study note based on simulated scenarios for the DVA-C02 exam. Always refer to the latest AWS documentation and best practices for production implementations.