An application team is designing a serverless API using Amazon API Gateway. The API must route incoming HTTP requests to a backend AWS Lambda function. The Lambda function requires access to the client request's HTTP headers, query string parameters, and API Gateway stage variables. To optimize development time, the team wants to implement this integration without writing or maintaining any custom mapping templates.
Which integration configuration should the developer choose to meet these requirements?
- Set the integration type to Lambda proxy integration for the API Gateway method.Answer
- BSet the integration type to Lambda custom integration and enable request body passthrough.
- CSet the integration type to HTTP proxy integration and configure a Cognito User Pool authorizer.
- DSet the integration type to AWS service integration, choose Lambda as the target service, and map request details to the integration request parameters.
Answer
Set the integration type to Lambda proxy integration for the API Gateway method.
The correct option is to set the integration type to Lambda proxy integration. With Lambda proxy integration, API Gateway passes the raw HTTP request directly to the backend Lambda function as a structured JSON object. This payload contains the body, headers, query string parameters, path parameters, stage variables, and request context. As a result, developers do not need to write or maintain VTL mapping templates, which satisfies the goal of minimizing configuration overhead.
Step-by-Step Solution
Key Concept
Understanding the difference between Lambda Proxy and Lambda Custom integrations in API Gateway.