A developer is implementing a REST API using Amazon API Gateway that integrates with a backend AWS Lambda function. The API needs to support search queries where clients can send arbitrary query string parameters and custom headers. The developer wants to ensure that any new query parameters or headers sent by the client are immediately available to the backend Lambda function without requiring modifications to the API Gateway integration or mapping templates.
Which configuration should the developer use to meet these requirements?
- Configure a Lambda proxy integration for the API method.Cevap
- BConfigure a Lambda custom integration and define a mapping template to extract and format the parameters.
- CCreate a custom Lambda authorizer to parse and inject the query string parameters and headers into the integration request.
- DConfigure an HTTP custom integration with a CORS policy that automatically forwards all incoming request parameters.
Cevap
Configure a Lambda proxy integration for the API method.
Configuring a Lambda proxy integration is the correct solution. In a proxy integration, API Gateway automatically passes the entire HTTP request—including all headers, query string parameters, path parameters, and request body—directly to the backend Lambda function as a single JSON object (the event parameter). This eliminates the need to configure mapping templates or explicitly declare allowed parameters in API Gateway, meaning any new headers or query parameters sent by the client are immediately visible to the Lambda function without modifying the API configuration.
Adım Adım Çözüm
Anahtar Kavram
Using Amazon API Gateway Lambda Proxy Integration to dynamically pass incoming headers and query string parameters directly to the backend function without mapping templates.
Tahmini Süre:1m 30s