Note: This blog post is part of the series on AWS Compute by AvoTechs. If you have landed here from a place other than the overview blog post, We suggest you start with AWS Compute – Virtual machines, containers or serverless
Serverless is a cloud-native development model which does away with the burden of managing servers. It essentially is a process which only consumes resources when they are used. Relating back to the mentioned “ship my laptop to Amazon” scenario, we could think of serverless as literally turning on your laptop just to process a request and shutting it down directly after the processing is done. Pros? Optimal resource consumption being the best. Cons? Vendor lock-in.
AWS offers two main serverless platforms – Lambda, being the first one is an event-driven compute service which can help you run code without provisioning or managing any infrastructure. Due to the vast range of events it can be integrated with, Lambda can be used to process HTTP requests (API Gateway), respond to new file uploads (S3), act on insert/update statements in a DB (RDS) and a lot more. It additionally follows the BYOC (Bring your own code) principle. Hence, if your app is built on Java, Go, PowerShell, Node.js, C#, Python, or Ruby code, you will not need to learn a new language to start using its superpowers.
The second serverless compute service is called Fargate, it essentially offers the same functionalities as Lambda but for containers. Running at scale is no longer an issue as scalability is in the heart of the serverless architecture pattern.
Flexibility of AWS Serverless Services
Lambda is available for numerous programming languages and Fargate is essentially as constrained as the container that’s used for its deployment. The only downside of using Lambda is the rather high vendor lock-in factor. Fargate, on the other side is an out-of-the-box solution for containers so very little additional effort is needed to start using it for your existing container-based apps.
AvoTechs Flexibility Grade: 5 (1 – not flexible, 5 – very flexible)
Maintainability of AWS Serverless Services
Both of the solutions come without the burden of managing servers. Hence, the effort to maintain them is rather low. I would even risk saying that we could build an app based on Lambda or Fargate today and it would still go strong in 5 years time providing there are no changes to the dependent components and APIs.
AvoTechs Maintainability Grade: 5 (1 – difficult to maintain, 5 – easy to maintain)
Scalability of AWS Serverless Services
The word serverless should actually be listed as a synonym of scalable. Making our serverless-based app scalable is literally no effort as we do not have to deal with dedicated resources. If the app logic is written correctly (DB locks, transaction atomicity, etc.), it can be scaled infinitely with just a few clicks.
AvoTechs Scalability Grade: 5 (1 – not scalable, 5 – very scalable)
Cost of AWS Serverless Services
There is a difference in how cost is calculated for Fargate and Lambda. Both of them follow a duration-based pricing model but on slightly different conditions.
Fargate is a container-based platform for which duration is calculated from the time you start to download the container image until the task terminates. There is a 15-minute minimum duration for Windows containers (+ additional OS license fee) and a 1-minute minimum duration for the remaining platforms. The price is calculated based on the number of vCPUs per hour and number of GB per hour
On the other hand, Lambda focuses on processing of events only and it solely depends on these 3 factors:
- Chosen architecture – x86 vs Arm
- Allocated memory
- Duration of the execution
Note: Additional charge may be incurred for ephemeral storage, provisioned concurrency or data transfer
At this point, coming up with sample calculations would probably be nice to have in this writeup. However, AWS has done a lot of the work for us and why copy it here if the internet offers a nice concept called hyperlinks…?
AWS Lambda pricing: https://aws.amazon.com/lambda/pricing/
AWS Fargate pricing: https://aws.amazon.com/fargate/pricing/
Note: Both of these sites offer an “Examples” section where various scenarios are listed.
Now, as for the grade – it’s a no-brainer that it gets the highest rating due to its rather low-entry cost which can increase as the demand increases.
AvoTechs Cost Grade: 5 (1 – expensive, 5 – cost-effective)
Would you like to find out more about other AWS Compute Services Amazon has to offer? Do you want to see when we recommend which option? Go back to the Overview article and navigate your way around from there.