API Gateway Integration with DynamoDB | Exam Question Answer | AWS Developer Certification

API Gateway Integration with DynamoDB

Prev Question Next Question

Question

As a developer, you have been told to create an API gateway stage that will directly interact with DynamoDB tables.

Which of the following feature of the API Gateway must be used to fulfill this requirement?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - A.

This is also mentioned in the AWS Documentation.

For example, with DynamoDB as the backend, the API developer sets up the integration request to forward the incoming method request to the chosen backend.

The setup includes specifications of an appropriate DynamoDB action, required IAM role and policies, and required input data transformation.

The backend returns the result to API Gateway as an integration response.

To route the integration response to an appropriate method response (of a given HTTP status code) to the client, you can configure the integration response to map required response parameters from integration to method.

Option B is incorrect since this is only required for cross-domain requests.

Option C is incorrect since this is only required for low latency to DynamoDB tables.

Option D is incorrect since this is only required if the request is not text-based.

For more information on the developer experience for the API gateway, please refer to the below URLs-

https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html#api-gateway-overview-developer-experience https://aws.amazon.com/blogs/compute/using-amazon-api-gateway-as-a-proxy-for-dynamodb/

The correct answer is A. Ensure to create an Integration request.

API Gateway is a fully managed service provided by AWS that makes it easy to create, deploy, and manage APIs. It enables developers to create RESTful APIs and WebSocket APIs that can be integrated with other AWS services or non-AWS services.

To interact with DynamoDB tables, we need to create an integration request in the API Gateway. Integration request is a feature that allows us to integrate our API with a backend service such as AWS Lambda, Amazon EC2, or DynamoDB.

To create an integration request, we need to follow the steps below:

  1. Go to the API Gateway console.
  2. Click on the "Create Resource" button to create a new resource.
  3. Click on the "Create Method" button and select the HTTP method (GET, POST, PUT, DELETE, etc.) that you want to use.
  4. Select "Use Lambda Proxy Integration" or "HTTP Proxy Integration".
  5. Enter the endpoint URL for DynamoDB and configure the integration request settings.

Once the integration request is set up, we can deploy the API Gateway stage and start using it to interact with DynamoDB tables.

Option B, Enable CORS, is used to allow cross-origin resource sharing, which is needed when an API is accessed from a domain different from the one that served the API. It is not related to interacting with DynamoDB tables.

Option C, Enable DAX, is used to enable DynamoDB Accelerator (DAX), a fully managed, in-memory cache for DynamoDB. It is used to improve the performance of DynamoDB by reducing the response time and increasing throughput. However, it is not related to interacting with DynamoDB tables through API Gateway.

Option D, Enable Binary Payloads, is used to enable binary data in the request and response payloads of an API Gateway API. It is not related to interacting with DynamoDB tables.