Serverless Solutions on AWS
Our customer, an education sector major player, have their workload on AWS. About 2 years ago, we developed Asp.Net based Web API that customer deployed on their API Platform, as a set of Rest APIs to be consumed by a mobile application, with possible addition of API Consumers in future. Their Annual AWS bill for this application was around $ 15,000, although not a big amount for customer, but, customer was worried once they start adding more API consuming Partners, their AWS bill will increase.
Customer Profile
Customer Profile
Our customer, an education sector major player, have their workload on AWS. About 2 years ago, we developed Asp.Net based Web API that customer deployed on their API Platform, as a set of Rest APIs to be consumed by a mobile application, with possible addition of API Consumers in future. Their Annual AWS bill for this application was around $ 15,000, although not a big amount for customer, but, customer was worried once they start adding more API consuming Partners, their AWS bill will increase.
During Second half of 2017, customer started development on extension of their API Platform, a set of APIs to be consumed by third party vendors. During architectural discussion for this application, customer requested us to find a cost effective, reliable, highly available and scalable solution for API Platform.
| AWS Services | Jan 2017 - Jun 2017 Cost | Jul 2017 - Sep 2017 Cost |
|---|---|---|
| EC2 | $ 6858 | $ 4572 |
| ELB | $ 107.1 | $ 53.55 |
| Other AWS Services ( Including Support) | $ 205.7 | $ 80.2 |
Goal
Goal
We analyzed that Compute (EC2) was responsible for almost 95% of cost. Sometimes servers were up serving very few (sometimes < 10) API requests per hour, during off peak season. However, still have to keep a minimum number of servers running, to make sure the application is available whenever required.
Solution
Solution
With this in mind, we re-architected our solution to utilize serverless architecture on AWS. We architected application to use AWS Lambda for Compute, API Gateway for deploying Rest APIs and AWS Cognito for Managing User Authentication and Authorization. During the First Quarter itself, we were able to significantly bring the cost down to < $400 from ~ $3000 for the last quarter.
We were also able to server more api requests. Our performance was at acceptable level and our customer was happy with AWS monthly costs for these APIs.
Tech Stack
Tech Stack
Our decision was to architect the APIs with the use of AWS Serverless components such as:
- AWS Lambda
- API Gateway
- AWS Cognito for Authentication (Less than 50k users)
| AWS Services | Oct 17 | Nov - Dec 17 | 2018 Forecast |
|---|---|---|---|
| AWS Lambda | $ 63.5 | $ 311 | $ 1,500 - $ 1,750 |
| API Gateway | < $ 3.5 | $ 7.0 | $ 42 - $ 49 |
| AWS Cognito (less than 50K users) | $ 0 | $ 0 | $ 0 |
Result
Result