An organization is exposing a database via a REST API using Amazon API Gateway. The developer configures an AWS Service Integration to retrieve user records directly from an Amazon DynamoDB table without using a compute layer like AWS Lambda. The API must receive requests containing a username path parameter, query the DynamoDB table, and return a simplified JSON payload to the client instead of the standard DynamoDB attribute-value JSON format. Which two configuration steps must the developer perform in API Gateway to meet these requirements?
- Create an Integration Request mapping template with an application/json Content-Type that uses Velocity Template Language (VTL) to format the payload for the DynamoDB GetItem action.Cevap
- Configure an Integration Response mapping template with an application/json Content-Type to transform the DynamoDB attribute-value JSON response into the desired simplified client JSON schema.Cevap
- CEnable Integration Proxy settings on the API Gateway resource to allow automatic payload transformation and parameter mapping between API Gateway and DynamoDB.
- DConfigure a Method Response mapping template to define the query parameters and payload schema sent to the DynamoDB integration endpoint.
- EImplement a Lambda Authorizer to validate the request credentials and rewrite the response payload received from the DynamoDB integration.
Cevap
The correct configurations are to create an Integration Request mapping template using Velocity Template Language (VTL) to format the DynamoDB GetItem payload, and to configure an Integration Response mapping template to transform the DynamoDB attribute-value response into clean client-facing JSON.
For an AWS Service Integration directly communicating with a backend database like DynamoDB, API Gateway must translate the HTTP request into the database's native API structure, which is accomplished via an Integration Request mapping template. Similarly, the database's response must be transformed from the attribute-value layout to clean JSON via an Integration Response mapping template.
Adım Adım Çözüm
Anahtar Kavram
API Gateway AWS Service Integration mapping templates (Request and Response)
Tahmini Süre:2m 0s