Question

Difficulty: MediumAPI Development and Integration with Amazon API Gateway

A developer is migrating a REST API endpoint in Amazon API Gateway that currently uses a Lambda custom integration to a Lambda proxy integration. Which of the following actions must the developer perform to ensure the API and backend Lambda function work correctly with the new integration? (Select TWO.)

  1. Modify the Lambda function response to return a JSON object containing the keys statusCodestatusCode, headersheaders, and bodybody.Answer
  2. B
    Configure an integration request mapping template in API Gateway to map the incoming JSON payload to the Lambda event structure.
  3. Remove any configured integration responses and method response mappings from the API Gateway resource.Answer
  4. D
    Define explicit method responses in API Gateway for each HTTP status code (200200, 400400, and 500500) to map backend errors to client responses.
  5. E
    Deploy a custom Lambda authorizer to validate the Amazon Cognito JSON Web Token (JWT) in the request header.

Answer

Modify the Lambda function response to return a JSON object containing the keys statusCodestatusCode, headersheaders, and bodybody, and remove any configured integration responses and method response mappings from the API Gateway resource.
The correct actions are to modify the Lambda function response format and remove configured integration/method responses. In a Lambda proxy integration, API Gateway bypasses integration and method response configurations, passing the backend response directly to the client. This requires the Lambda function to return a structured JSON response containing the HTTP status code, headers, and stringified body.

Step-by-Step Solution

1
Identify the response requirements for API Gateway Lambda Proxy integration.
The backend Lambda function must return a JSON payload with statusCodestatusCode, headersheaders, and bodybody fields.
API Gateway expects this specific structure to parse and build the HTTP response in proxy mode.
2
Determine the configuration changes needed in the API Gateway console for proxy integration.
Remove custom integration responses, method responses, and mapping templates.
Proxy integration routes the request and response directly without using API Gateway mapping templates or custom integration response configurations.

Key Concept

Understanding request and response handling differences between API Gateway Lambda Proxy and Lambda Custom integrations.
Estimated Time:2m 0s
Rate this question