What is AWS Lambda?
This is a computing platform that was introduced in November 2014. It is a compute service that lets you run code without provisioning or managing servers. It is serverless, and Amazon provides it as a part of Amazon Web Services. Codes can be run in response to events. Since its serverless, there is no cost incurred when the code is not running.
Though new in the market it has gained immense popularity because of its financial benefits and also for the fact that even after 12 months of account sign up it does not expire which is common for most AWS services.
The Pricing Benefits of AWS Lambda
The cost-effectiveness is a benefit of this computing platform. The amount of memory allocated to the function from when the codes start execution to their return or termination is what you pay for. It’s the user who selects the amount of memory required for the function and accordingly is provided with proportional CPU power and other resources. Thus a user shells out $0.0000002 per request, which is the same for all the requests across all the functions.
1 Minute REQUEST per month
|1 Minute REQUESTS FREE
First 1 Minute requests per month are free.
400,000 GB-SECONDS PER MONTH FREE
First 400,000 GB-seconds per month, up to 3.2M seconds of compute time, are free.
of compute time per month.
|$0.2 Per 1M Requests thereafter||$0.0000166667 for every GB-second used afterwards|
|The Lambda free tier does not automatically expire at the end of our 12-month AWS Free Tier term but is available to both existing and new AWS customers.||$0.0000002 per request||The price depends on the amount of memory we allocate to our function|
Additional charges implications:
Extra charges and applicable only when the Lambda function makes use of other AWS services or transfers data.No charges apply when data is transferred between Amazon Glacier, Amazon DynamoDB, Amazon SES, Amazon S3, Amazon Kinesis, Amazon ECR, Amazon SNS and AWS Lambda functions which are in the AWS region. However, EC2 data transfer rates are applicable when data is transferred “into ” or “out” of the AWS Lambda functions from outside the region.
Example of some rates in the U.S. (VIRGINIA)
|Memory (MB)||Free tier seconds per month|
What is serverless API?
Even as the servers exist the developer does not have to be bothered about servers because it’s taken care of by AWS(Amazon Web Services) which is very comprehensive. API (Application Program Interface)can be used to request the Operating System by the programmer writing an application program.
What is the Dashboard?
This service is to monitor, debug and simultaneously improve the lambda functions. It is meant mainly to help serverless applications which are the most cost-effective and fast ways to build back end applications. Thus it navigates logs faster, metrics and traces. It helps to find bottlenecks and also visualizes resource usage. The Dashboard also helps to detect parts of the system which are increasing the cost while displaying the actual causes of slow functions. Because of its various benefits over nearly 1000 companies are already utilizing Dashboard. It is comparatively easy to set up by just deploying a pre-configured Cloud Formation template where no codes need to be changed to the Lambdas. This helps to solve present development issues and real-world problems.
|Free 1 million invocations||25 GB of log ingestion||Enterprise-level scale|
|Unlimited functions||10M invocations per month||Server less advisory|
|7-day data retention||14-day data retention||Custom data retention|
Let’s see a comparison of AWS Lambda and Amazon EC2
|.||AWS Lambda||Amazon EC2|
|1||Server less computer platform||Server application. EC2 stands for virtual server-based resources|
|2||It requires less costing. Costing is mainly time-based.||The costing of EC2 is higher than of lambda. Hourly prices range from $0.011/hour to $0.27/hour ($94/year to $2367/year).|
|3||The setup and management of lambda is user-friendly and scaling is fully automated.||Working with EC2 is a bit complicated as it requires logging in via SSH and manually installing Apache.|
|4||Using Lambda we have higher flexibility but it is not so secure and can have surface attacks||Using EC2 we need to take care of the security levels . We can give multiple security levels and certain protocols like TCP, UDP, ICMP.|
Lambda’s pricing is low but unpredictable. Low costs are often cited as a benefit of using the serverless. A recent survey has shown that companies saved an average of 4 developer workdays per month by adopting serverless, and 21% of companies reported cost reduction as the main benefit.
REQUEST – Every request costs about $0.0000002.
DURATION – It is free for a few minutes and later charges per GB-second, which is the duration in seconds multiplied by the maximum memory size in GB. Every GB-second costs $0.0000166667.
AWS Lambda eliminates the need for provisioning or managing servers and lets the user run code with zero administration. Let’s see how it works:
1. Upload your code to AWS Lambda or write code in Lambda’s code editor.
2. Set up your code to trigger from other AWS services
3. Lambda runs your code only when triggered, using only the compute resourced required
The best part is you pay just for the compute time you use.
Yes, AWS Lambda is cheaper than Amazon EC2.
As mentioned in the above comparison table, AWS Lambda is billed based on Requests and Durations, on the other hand, the Amazon EC2 is billed on the running time. Take a look at the below use case to see which is cheaper:
Use case: For a website/app with low/infrequent traffic, let’s assume
10000 hits per day over 24 hours
The execution time: 200ms per hit at 512 GB
The user will end up with 432,000 requests/month and 2160 GB-sec of compute/month.
Total AWS Lambda cost would be $0.31/month.
Total Amazon EC2 cost (for smallest instance t2.nano) will be 10X the AWS Lambda cost.
This use case has small numbers and as the infrastructure scales, the cost will increase.
The cost of Amazon EC2 is higher due to running time for 24 hours (hence multiplied by 24), on the other hand, AWS Lambda has lower cost due to non-dependency on running time.