1

I've been looking into Spring-Cloud-Function and Spring-Cloud-AWS recently and all of the capabilities that the Spring modules provide, however, one thing I'm not too clear on is really whether the two properly go together.

I can see Spring Cloud function and maybe S3 being used together but there is no support for AWS' serverless DB, DynamoDB.

Would it be good or bad practice to use Spring Cloud Function (AWS Lambda) with RDS? Is the fact that DynamoDB is a non-blocking DBS a better fit for Lambda's and their billing structure?

Marc Thomas
  • 393
  • 1
  • 3
  • 16

2 Answers2

1

I have created a sample Spring Cloud Function for AWS Lambda on my github. It uses AWS Java SDK to request for S3 objects. I have also written another sample with integration with AWS SQS.

So, I think it will be easy to integrate with DynamoDB as there is also Java sdk available for DynamoDb (although I have not personally used it before)

IMHO, I think because AWS Lambda charges by execution time, and initiating the connection to the RDS might also take up some time (same for shutting down).

Besides that, for scaling purposes, if your Lambda function was triggered in high frequency within a short period. Each of the lambda function will try to establish sql connection to the RDS and might eventually cause an overhead to the RDS.

What I did for my project is that I exposed an API endpoint on the web application and direct the traffic from lambda to the endpoint. Since SQL connection can be reused within the web app, I guess it is more efficient.

Ps. I have yet to use DynamoDB. So I cant comment much on that.

mengjiann
  • 275
  • 3
  • 12
1

I would say Spring Cloud Function with the Spring eco system behind is a good basis for accessing DynamoDB from a Lambda function.

There is a community-supported Spring Data module for DynamoDB.

You might have a look at my article, where I'm using Spring Cloud Function with Spring Data DynamoDB.

markusgulden
  • 503
  • 1
  • 6
  • 18