A developer is configuring a REST API in Amazon API Gateway that integrates with a backend AWS Lambda function. The API currently uses a Lambda proxy integration. The developer wants to modify the structure of the incoming client JSON payload before it is passed to the backend Lambda function. The developer attempts to configure a mapping template in API Gateway but finds that it has no effect on the payload received by the Lambda function. Which of the following actions should the developer take to resolve this issue?
- Change the integration type to a Lambda custom integration, and define an integration request mapping template in API Gateway to transform the payload.Cevap
- BKeep the Lambda proxy integration, and configure a mapping template in the Integration Request section of API Gateway to transform the payload.
- CImplement a custom Lambda authorizer to intercept the incoming request, modify its structure, and pass the updated payload to the integration.
- DKeep the Lambda proxy integration, configure an API Gateway Model, and map the properties directly within the Method Request configuration.
Cevap
Change the integration type to a Lambda custom integration, and define an integration request mapping template in API Gateway to transform the payload.
The correct action is to change the integration type to a Lambda custom integration. In Amazon API Gateway, a Lambda proxy integration passes the raw request directly to the backend function without processing mapping templates. To utilize API Gateway's native request transformation capabilities, such as defining Velocity Template Language (VTL) mapping templates in the Integration Request, a Lambda custom integration must be used.
Adım Adım Çözüm
Anahtar Kavram
API Gateway Lambda Custom vs Proxy Integration request mapping capabilities
Tahmini Süre:1m 30s