We keep a close eye on the cloud services budget for our clients. Keeping recurring costs down is part of our value-add.
Leveraging serverless technologies on a recent project allowed me to save my client hundreds of dollars per month on their AWS bill and get a critical feature up and running in hours instead of weeks.
What is Serverless?
In recent history, if you wanted to deploy code to the web, you needed to provision a server (or a set of servers). These servers would run in a data center 24/7, prepared to respond to internet requests at any time of day. Even if your server was receiving no requests, it would still be running, waiting, ready to respond.
For a provisioned server, you pay for every minute of run time, whether it’s idle time or working time (serving requests). This can cost anywhere from $40 to $1200 per month for a single provisioned server. You need to configure these servers, secure them, monitor them, and maintain them which adds human time and cumbersome overhead.
Serverless technology came to fruition in the last few years and allows you to deploy code to the web where it will sit in a quiescent state and wait for a request. When the request occurs, the code is launched and run, and then it returns to its quiescent state. You only pay for the time that your code was executing. And you don’t have to configure a server or maintain a set of servers. You simply write your code and deploy it.
For serverless, the cost for execution time is fractions of a penny per minute. Security, scalability, and monitoring are all built-in. This is the new paradigm and it’s game-changing for small businesses with reasonable loads. It can lead to dramatic cost savings. Cloud providers like AWS have many serverless offerings, from simple code execution to gateways and databases, where you only pay for what you use.
My Serverless Experience
We were three days away from launch when my client realized we needed the ability to store state for a web application running on a third-party service. We needed a high availability, secure solution that could scale and we needed low latency storage and retrieval times. I had about 24 hours to come up with an implementation, configure it and get it launched and tested.
The cost and effort of setting up a high availability database server with a web front end, load balancer, and appropriate scalability was not in the cards for this project and would have taken days or weeks to configure and easily cost over $600/month when all was said and done.
Enter the Serverless Solution
Utilizing three simple serverless offerings from AWS:
- API Gateway
- DynamoDB
- AWS Lambda
Within four hours I set up my DynamoDB, created several secure RESTful endpoints using API Gateway, and added some Lambda code to handle data translation and packaging. My project launched two days later and my newly configured backend started receiving a few thousand requests per hour. My response time averaged 184ms. My database started processing 10,000 records per day and it’s been running for the past month with high loads, lightning-fast response times, and zero failures.
But here’s the best part, my total cost for the month – $1.30. That’s right. Less than $2. My Lambda service didn’t even break the generous free tier of 1M requests. I had 523k requests during the month, so my Lambda cost for the month is $0.00 and would cost only $0.20 for each additional 1M requests. That’s $0.20 for an additional 23 requests every minute! So even if my traffic quadrupled, I would still be paying less than $10 for these services. In addition, I’d get all the additional benefits of zero maintenance, high availability, and no hassling with server and tool configuration.
This is my AWS bill for the first month:
Also, I can monitor all of my backend services using AWS CloudWatch for a few extra pennies per month. The dashboard below was configured in minutes and gives me an ongoing summary of my backend performance.
It’s Time to Think Serverless
The cloud is making it too easy for small business to adopt modern, scalable, performant and secure technology at incredibly low cost. The serverless revolution is here. Get on board, dazzle your customers and inspire your employees.
Now is the time to leverage the serverless technologies in the cloud, save money and increase your business agility.