Some time ago I was given the opportunity to help work on a backend with Nestjs. Interestingly, this project will be deployed on AWS lambda with DynamoDB as a database. A few months running I discovered the fact that backend server costs can be very cheap.
Why Lambda?
Usually if we rent a conventional server, we have to pay monthly even though the traffic is small.
Well, with Lambda because the concept is serverless, the backend is only alive when there is a request. So there is no 24/7 standby server. It becomes cost-effective.
What’s even more interesting is that AWS gives a fairly large free allowance: 1 million requests per month and 400 thousand seconds of computation. So yes, if the website traffic is still small, the backend cost can be almost zero 🙂.
DynamoDB Integration
For the database, I use DynamoDB, AWS’s NoSQL. The scale is automatic, and the cost is also more reasonable than RDS.
For example:
Write requests: from $1.25 per 1 million requests
Read requests: from $0.25 per 1 million requests
As a result, when combined with Lambda, even backends with fairly complex logic can run stably without breaking the bill.
What about development time?
I use Serverless Framework to simplify development & deployment
The good thing is, some AWS services can be simulated locally (for example API Gateway & Lambda with the serverless-offline plugin, or DynamoDB using serverless-dynamodb-local). So the coding process remains flexible, testing is not complicated, and deploying to Lambda is also very easy.
I think the combination of Lambda + DynamoDB is perfect for an economical but scalable backend. Has anyone tried a setup like this too? Or have other alternatives that are more economical? 🚀
Leave a Reply