Q78 — AWS DVA-C02 Ch.2
Question 78 of 100 | ← Chapter 2
A developer is building a mobile application that invokes a backend service via an Amazon API Gateway REST API. During integration testing in development, the developer wants to simulate various backend responses without actually invoking the backend service. Which solution satisfies this requirement with minimal operational overhead?
- A. Create an AWS Lambda function. Use API Gateway proxy integration to return constant HTTP responses.
- B. Use an AWS CloudFormation template to launch an Amazon EC2 instance hosting a mock backend REST API.
- C. Customize the API Gateway stage to select response type based on the request.
- D. Use request mapping templates to select mock integration responses. ✓
Correct Answer: D. Use request mapping templates to select mock integration responses.
Explanation
Option D leverages API Gateway’s built-in mock integration feature, where request mapping templates define conditional logic (e.g., based on path, query, or headers) to return predefined HTTP status codes, headers, and bodies—requiring zero backend infrastructure or code. Option A introduces unnecessary Lambda management and cold starts. Option B deploys and maintains full EC2 infrastructure. Option C misrepresents API Gateway capabilities: stages do not dynamically select response types; routing is handled via resources/methods/mapping templates. Thus, Option D is the simplest, most lightweight, and native solution.