Soru

Zorluk: OrtaAPI Development and Integration with Amazon API Gateway

A developer is building a serverless application using Amazon API Gateway and AWS Lambda. The application needs to access the client's source IP address and the incoming request headers within the Lambda function. The developer wants to achieve this with the least amount of operational effort and without writing manual mapping templates.

Which configuration should the developer choose for the API Gateway integration to meet these requirements?

  1. Configure a Lambda proxy integration for the API method.Cevap
  2. B
    Configure a Lambda custom integration and write a Velocity Template Language (VTL) mapping template to pass the request context parameters.
  3. C
    Configure an Amazon Cognito User Pool authorizer to forward the request metadata in the authorization context.
  4. D
    Configure a mock integration in API Gateway that maps the headers and source IP address into the integration request path parameters.

Cevap

Configure a Lambda proxy integration for the API method.
Configuring a Lambda proxy integration is the most efficient approach because API Gateway automatically passes the entire raw request—including headers, query parameters, and the request context containing the client source IP—to the backend Lambda function as the input event object. This configuration requires no manual integration mapping templates, minimizing development and operational effort.

Adım Adım Çözüm

1
Analyze the requirements for metadata mapping.
The client's source IP address and request headers must be sent to the Lambda function.
This establishes the data contract needed by the Lambda function.
2
Evaluate the integration options to minimize manual mapping effort.
Lambda proxy integration automatically formats the incoming request data as a JSON object containing headers and request context (with source IP), passing it directly to the Lambda function.
This avoids the need to write Velocity Template Language (VTL) mapping templates, satisfying the requirement to minimize operational overhead.

Anahtar Kavram

API Gateway Lambda Proxy Integration
Tahmini Süre:1m 30s
Bu soruyu puanla