Serverless computing is one of the fastest-growing cloud public services. The advancement of technology from servers to dockers and the elevation in cloud computing inevitably leads to Serverless computing. Serverless architecture is the Tetris of the jigsaw puzzle. Solving the application’s problem is easy and quite a lot of fun.
Living in a world of instant gratification, why does IT need to be any different? Serverless computing has a low time to market (TTM) and highly scalable. In a serverless architecture, the application infrastructure (servers, networks, etc.) and its management (scaling, updates, etc.) are taken care of by the cloud provider.
What Does It Have To Do With Students?
Students are highly optimistic, full of life, and have a lot of time. It is one of the best times in their life to start a business. In today’s world, an MVP (minimum viable product) or at least a prototype of the application is a must to sell your idea to the right people.
When it comes to an application, the code and infrastructure are like the two sides of a coin. The code part, to an extent, is covered as part of the college curriculum. The initial infrastructure setup might be overwhelming but, that’s where serverless architecture rocks. Since serverless architecture abstracts the infrastructure layer, setting up and maintaining infrastructure is simple. So you don’t have to spend much time on it and dive directly into coding your business logic.
One of the reasons why students give up on their ideas is the cost involved in building and running the application during the ideation/prototype phase. But, what if we could overcome it? The cost of prototyping a simple serverless application is highly economical, and if you include the free tier offers, the total cost is negligible.
Application Prototyping Cost ( < $0.5 )
Let’s dive into the cost of building an application on Amazon Web Services (AWS) using serverless services. The costing shown below excludes the “Free Tier” offering provided to encourage the AWS services exploration. A typical application consists of the presentation layer, the application layer, and the data layer. Let’s see the base AWS services involved with each of these layers, and of course, their cost.
The Presentation Layer
Amazon Simple Storage Service (S3)
Amazon Simple Storage Service (S3) is an object storage service offered by AWS. You can store an unlimited number of files with a maximum file size of 5TB. All your presentation layer files ( webpages ) are stored here. The standard storage cost for the first 50 TB stored in the month is $0.023 per GB. Generally, the size of a simple website is much lesser than 1 GB, but for simplicity, let’s consider the cost of 1 GB of storage.
Cost of S3 storage for 1 GB = $0.023
With the free tier, you get 5GB of free storage for 12 months.
For more information on Amazon S3 Pricing
The total cost of application = $0.023
Amazon API Gateway
The Amazon API Gateway is used to create HTTP, REST, and WebSocket APIs. The HTTP API is invoked from the webpage to access the business logic of the application. For generic use cases and our scenario, let’s consider an HTTP API. HTTP APIs cost $1 for a million requests for the first 300 million requests in a month. Most amazon services are pro-rated. Let’s consider that our application receives 10,000 API requests in a month.
Cost of API Gateway’s HTTP API = ($1 / 1 million)*10000 = $0.01
With the free tier, you get 1 million API Calls free per month for 12 months.
For more information on Amazon API Gateway Pricing
The total cost of application = $0.023 + $0.01 = $0.034
The Application Layer
AWS Lambda is the serverless compute service offered by AWS. Here, you code your business logic without having to worry about managing servers. The HTTP API created in the API Gateway can trigger an AWS Lambda. With proper permissions, you can access any AWS service from Lambda using the AWS SDK. Lambda is costed for the number of invocations and the combination of code execution time and the memory consumed. For our application, let’s consider an average lambda duration of 1 second at 128MB memory.
Cost of AWS Lambda = (1000ms x $0.0000000021 x 10000 API Gateway executions) + (10000 * 0.2/1000000) = $0.021 + $0.002 = $0.023
With the free tier, you get 1 million requests and up to 3.2 million seconds of compute time free per month.
For more information on AWS Lambda Pricing
The total cost of application = $0.034 + $0.023 = $0.057
The Data Layer
Amazon DynamoDB is a serverless NoSQL database service offered by AWS. Apart from the core features like Read and Write requests, DynamoDB provides plenty of optional features like Global Tables, DAX, DynamoDB Streams, etc. The pricing depends on the feature usage and the capacity mode (provisioned capacity and on-demand capacity). For simplicity, let’s consider the DynamoDB cost based on the 10000 reads/ 5000 writes and storage size of 1GB.
Cost of Amazon DynamoDB = $0.0025 (10000 reads * $1.25/1000000) + $0.00625 (5000 writes * $1.25/1000000) + $0.25 (1GB Storage) = $0.25875
The free tier provides 25 GB of storage, 25 provisioned Read/Write Capacity Units.
For more information on Amazon DynamoDB Pricing
The total cost of application = $0.057 + $0.25875 = $0.31575
There you have it, the cost of prototyping a simple serverless application is approximately $0.31575, and this cost is excluding the free tier offers. The low cost coupled with the pay-as-you-go model removes the initial investment factor from trying out an idea. The serverless computing model opens up new gateways to ideation/prototyping, which was not possible previously.
Further reading: A list of open-source projects to help you get started with serverless applications!