A developer is migrating an Amazon API Gateway REST API from a Lambda custom (non-proxy) integration to a Lambda proxy integration. The API endpoint handles user profile updates and accepts query string parameters. Which TWO changes must the developer make to ensure the backend Lambda function and API Gateway integration function correctly after this migration?
- Modify the Lambda function's return statement to output a JSON object containing the status code, headers, and body.Answer
- Update the Lambda function code to retrieve query parameters from the structured properties under the event object instead of root-level keys.Answer
- CConfigure integration response mapping templates in API Gateway to map the backend response to the client response.
- DConfigure method response headers and HTTP status codes in API Gateway to match the statuses returned by the Lambda function.
- EDeploy a custom Lambda authorizer to validate Cognito JSON Web Tokens instead of using the built-in Cognito user pool authorizer.
Answer
The developer must modify the Lambda function's return statement to output a JSON object containing the status code, headers, and body, and update the Lambda function code to retrieve query parameters from the structured properties under the event object instead of root-level keys.
Migrating to a Lambda proxy integration simplifies configuration because API Gateway automatically forwards the raw request and response. The developer must update the Lambda function to return a structured JSON object containing the status code, headers, and body, and retrieve client request parameters from structured paths like event.queryStringParameters instead of root-level keys.
Step-by-Step Solution
Key Concept
Understanding the difference in input/output payload structures and configuration requirements between API Gateway Lambda Proxy and Custom integrations.