A developer is configuring a REST API in Amazon API Gateway to integrate with a backend AWS Lambda function. To minimize administrative overhead and avoid writing custom mapping templates, the developer decides to use a Lambda proxy integration. Which TWO requirements must be met to ensure this integration works correctly? (Select TWO.)
- The Lambda function must return a JSON object containing at least statusCode, headers, and a stringified body.Cevap
- API Gateway automatically passes the entire client request (including headers, query parameters, and body) as a single JSON object to the input event of the Lambda function.Cevap
- CThe developer must define Integration Response mappings in API Gateway to map the Lambda output to specific HTTP status codes.
- DThe developer must configure a custom Lambda authorizer to parse incoming query string parameters before passing them to the Lambda function.
- EThe Lambda function must return a raw string containing the HTTP body, and API Gateway will automatically wrap it in a 200 OK status.
Cevap
The Lambda function must return a JSON object containing at least statusCode, headers, and a stringified body; and API Gateway automatically passes the entire client request (including headers, query parameters, and body) as a single JSON object to the input event of the Lambda function.
In a Lambda proxy integration, API Gateway passes the raw client request directly to the Lambda function as a single JSON event structure, removing the need for request mapping templates. On the response path, API Gateway expects the Lambda function to return a specific JSON format containing the status code, headers, and body. If the function returns a raw string or lacks the expected structure, API Gateway will throw a 502 Bad Gateway error.
Adım Adım Çözüm
Anahtar Kavram
Understanding request and response structure in API Gateway Lambda Proxy integration