AWS Certified Developer – Associate / Question #821 of 557

Question #821

A company is developing a microservices-based application on AWS using Amazon API Gateway. Multiple teams are working on frontend and backend components concurrently. The company needs to enable frontend teams to test API interactions by simulating responses with specific HTTP status codes and payloads before the backend services are fully developed. Which approach will achieve this goal?

A

Create API Gateway resources and configure the integration type as MOCK. Define method integration responses and method responses to return predefined HTTP status codes and payloads. Deploy the API to a stage for testing.

B

Create an Amazon SNS topic to publish mock responses. Configure API Gateway with an HTTP_PROXY integration to forward requests to SNS. Use mapping templates to generate static responses.

C

Develop an AWS Lambda function that returns static responses. Configure API Gateway with an AWS_PROXY integration to invoke the Lambda function. Deploy the API and share the endpoint with frontend teams.

D

Set up an Amazon EC2 instance hosting a mock server. Configure API Gateway with an AWS integration to route requests to the EC2 instance. Deploy the API and update the EC2 mock server as needed.

Explanation

Answer A is correct because API Gateway's MOCK integration type enables developers to configure static responses directly within API Gateway. By defining method responses (HTTP status codes) and integration responses (payloads), teams can simulate API behavior without backend dependencies. This approach avoids unnecessary complexity (e.g., Lambda functions in Option C, EC2 instances in Option D, or SNS in Option B) and leverages native API Gateway features.

Key Points:
1. MOCK integration is designed for testing without backend services.
2. Integration responses and method responses allow customization of HTTP codes/payloads.
3. Other options (B, C, D) introduce additional services (SNS, Lambda, EC2) that add overhead and deviate from the simplest solution.

Answer

The correct answer is: A