Hey guys - had a question regarding serverless sys...
# random
l
Hey guys - had a question regarding serverless systems (like AWS lambda) for folks who have used it for a bit. I am thinking of using it for a simple side project - but that will have DB access and authentication, etc. Would you recommend trying to use it for such an application? Or is it better avoided? I am mostly thinking about how management of DB connections & pooling would work? (if I am thinking about using Postgres / MySQL over AWS RDS)?
I understand what the basic use case of Lambda is (great example is auto-resizing of images uploaded to an S3 bucket as and when it is uploaded). But was wondering if you could do a complete app on it without substantial hassles.
b
Hey Saurabh, the serverless ecosystem on AWS is more than capable to handle very sophisticated applications. Happy to chat over DMs to see if I can help you choose the right services πŸ™‚
πŸ‘ 1
Also if it is a side project, I would recommend you use DynamoDB and it ties really well with lambda and is easy on the pocket with a generous 25 GB free tier.
πŸ‘ 1
v
The general advice is don't use lambda behind a web service, it's not built for that. About AWS RDS over Postgres -- RDS is worth the cost. It has a lot of operational benefits you will be hard pressed to get from regular, unmanaged postgres
πŸ‘ 3
l
Hey @brash-monitor-80970 thanks for the vote of confidence. That helps. I am also leaning towards DynamoDB. FaunaDB also looks good - but I think I am going to stick with the AWS ecosystem to make it easier this time around for me. https://www.serverless.com/learn/courses/full-stack-application-development-on-aws/ is a great course on doing a full stack app with auth on AWS which I am going through.
Thanks @victorious-energy-56764 you mean I should not have a web service (say using Python and Django on an EC2 instance talking to Lambda right)? My plan was to have a VueJS front end talk directly to lambda for all its API requirements and then lambda talks to DynamoDB.
b
Awesome. If you want to stick with the AWS Ecosystem I would recommend the following - AWS Amplify for Front End APIGW + Lambda for your API layer. You can complement the API layer by using other services like Step Functions / SQS / SNS / Eventbridge etc DynamoDB for Database. Quick heads up - Modelling on top of DynamoDB is totally different when compared with relational database. You should use single table design i.e one table for all your application to use DynamoDB efficiently
@loud-glass-33663 - you will have to attach an API Gateway to Lambda to make it work as an independent API.
πŸ‘ 1
c
@loud-glass-33663 we are using maximum offerings from AWS serverless ecosystem for few of our client projects let me know if you want to hop on a call happy to help
πŸ‘ 1
c
@loud-glass-33663 I am not sure whether Supabase fits your requirements. Looks pretty exciting to me and I am planning to use in my next side project (to test where the limits are).
πŸ‘Œ 1
l
This looks pretty cool @calm-grass-85557 Hadn’t heard of them. This would also work definitely - but I would need to spin an RDS instance and keep running which can get pricey. On reading up a bit more and getting advice from folks here, I think DynamoDB or FaunaDB is a better fit for a serverless type of setup which has more of a per-usage fee compared an always-on fee. But thanks for this. It is very interesting!
πŸ‘ 1
c
@loud-glass-33663 you can try AWS aurora serverless(Postgres/Mysql) with 2-4ACU autoscaling (using it in production since last 1.6 yrs)
πŸ‘ 1
m
@loud-glass-33663 do look out for DynamoDB limits, β€’ document size can not exceed 400KB. β€’ only index-fields can be queried, β€’ sorting is only supported on range fields(sort key), β€’ price is pretty minimal but, AWS charge to mange indexes It looks like a regular no-SQL database like mongo but it is not. So, one has to be aware of the query operations to be performed, while modeling a Dynamodb table. If you want to use SQL: 1. check out Aurora serverless, no hassel to keep running database servers 24x7 2. check out Amazon RDS proxy with lamdba, new feature. Your Lambda functions interact with RDS Proxy instead of your database instance. It handles the connection pooling necessary for scaling many simultaneous connections created by concurrent Lambda functions. This allows your Lambda applications to reuse existing connections, rather than creating new connections for every function invocation.
πŸ‘ 2
l
Thanks @crooked-ghost-83128 @many-knife-55841, your insights are very welcome. Thank you. I have a few years of Mongo experience which I was hoping to transfer over to Dynamo - but will be careful. Either ways, I don’t think this side project is going to need a lot - so it should be a good learning experience. RDS proxy is something I was not aware of - so thanks for sharing that bit. Will look it over as well. Aurora Serverless has been a revelation. Thanks again folks πŸ™
πŸ‘ 2
πŸ”₯ 1
a
You should think of something like Cloud Run or Container Instances. Lambda is not for the use case you mentioned. In fact in many cases it might affect the service, if your DB is taking long time to respond or various other situations.