Is Direct Integration API Gateway to DDB Still Supported?

0

My website http://theleedz.com has a very slow-performing DynamoDB query on its front page that I was hoping to improve using a direct integration strategy from API Gateway. Several AWS documents including 'Using Amazon API Gateway as a proxy for DynamoDB' suggests that it is possible -- but they and all the stackoverflow threads about the subject are years old and some of the UI features and options mentioned are no longer available. For example:

https://aws.amazon.com/blogs/compute/using-amazon-api-gateway-as-a-proxy-for-dynamodb/ 'AWS Service Proxy' is not an integration option on API Gateway

https://medium.com/@likhita507/using-api-gateway-to-get-data-from-dynamo-db-using-without-using-aws-lambda-e51434a4f5a0

API Gateway no longer provides 'Add Resource' or any of the Resource/Integration Request model described in this post. The only integrations available for a Route are

  • Lambda Function
  • HTTP URI
  • Private Resource
  • Event Bridge
  • Simple Queue
  • App Config
  • Kinesis
  • Step Function

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-integration-types.html Where are these integration types?

Is this kind of direct integration still supported at all?
Is it possible to pass through a DynamoDB get_item request direct from API Gatway and skip the lambda function entirely, assuming my client can handle the return data?
Where is the mapping between the incoming GET request and the 'get_item' -- this must be some part of the DevOps config but I can't figure out where.

Thank you, +Scott Gross theleedz.com

3 Answers
0
Accepted Answer

There ae two types of APIs in API Gateway: REST APIs and HTTP API. HTTP API never supported direct integration with DynamoDB. REST API does support it. You can see the AWS integration type here. If you use REST API, you will see that the docs you pointed to, make sense now.

profile pictureAWS
EXPERT
Uri
answered 24 days ago
0

To follow-up -- I was successful in converting some of my APIGateway -> Lambda -> DynamoDB routes to Direct Integrations between API Gateway and DynamoDB. The results have dramatically improved load times. The approach could be widely widely applicable for other developers. Here's how I did it:

How to Optimize your Serverless App with API Gateway Direct Integration: http://scottgross.works/papers/direct

profile picture
answered 21 days ago
  • Good summary of what you did. I want to emphasize that you should not use Lambda functions just to move data from one place to the other, if you have a direct integration available. So now you are following the best practices.

    Saying that, in your Lambda function you initialized the DDB client and the table inside the handler, which means you do it in each invocation. Instead, you should do those type of initializations outside the handler. First, you get a CPU boost during the init, and second, you initialize the clients only in the first invocation. If you make these changes, I am sure that your latency with a Lambda function will be better that what you had (but not better than direct integration).

0

YES -- thank you. The GUI has changed, some of the options are difficult to find and it actually took an entire day to follow your instructions successfully. The results are up at theleedz.com and much faster. I should write my own whitepaper on how to do it. In the meantime, here are some links that can help everyone else struggling with this topic. Good luck!

https://medium.com/@paul.santus/deploy-a-simple-data-storage-api-with-very-little-code-using-amazon-api-gateway-and-dynamodb-a00e9e03672

https://medium.com/@likhita507/using-api-gateway-to-get-data-from-dynamo-db-using-without-using-aws-lambda-e51434a4f5a0

https://aws.amazon.com/blogs/compute/using-amazon-api-gateway-as-a-proxy-for-dynamodb/

profile picture
answered 24 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions