Question

Difficulty: MediumAPI Development and Integration with Amazon API Gateway

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?

  1. Configure a Lambda proxy integration for the API method.Answer
  2. B
    Configure a Lambda custom integration and define a mapping template to extract and format the parameters.
  3. C
    Create a custom Lambda authorizer to parse and inject the query string parameters and headers into the integration request.
  4. D
    Configure an HTTP custom integration with a CORS policy that automatically forwards all incoming request parameters.

Answer

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.

Step-by-Step Solution

1
Analyze the requirement to dynamically forward client-supplied query parameters and headers without maintaining mapping configuration in API Gateway.
Identify that the system must forward the raw incoming HTTP request context directly to the backend.
This establishes that any manual mapping (which is required by custom integrations) will not meet the requirement of zero maintenance when parameters change.
2
Evaluate API Gateway integration types for Lambda backends.
Lambda proxy integration automatically wraps the raw request in a standardized JSON payload and forwards it directly to Lambda. Lambda custom integration requires VTL templates for mapping.
This shows that proxy integration is the designed solution for passing headers, parameters, and body directly to the Lambda execution context.
3
Assess the impact of security and auxiliary features like Lambda Authorizers and CORS.
Authorizers are verified as security mechanisms, and CORS is identified as a client-side access control configuration, neither of which routes request parameters.
This eliminates options that misuse security features for data passing purposes.

Key Concept

Using Amazon API Gateway Lambda Proxy Integration to dynamically pass incoming headers and query string parameters directly to the backend function without mapping templates.
Estimated Time:1m 30s
Rate this question