Taking Knowledge Discovery to the Next level
As you know, AWS lambda is a serverless computing provided by Amazon. The concept "Serverless" has worn out it's welcome in many industries, mainly for mission critical applications. The word "Server less" doesn't mean no server involved but it means that the server, the operating system, the network layer and other infrastructure is already taken care of.
AWS lambda is majorly adopted to achieve scalability, performance and cost efficiency without managing underlying infrastructure. The workloads scale to thousands of concurrent requests per seconds and serving trillions of requests per month.
How does it work?
Each lambda function runs in its own container. AWS manage lambda functions on multi tenant cluster machines where any cloud function executed in new container. Before executing the function, each container is allocated with necessary RAM and CPU capacity. AWS will calculate the charges by multiplying configured RAM and the amount of time the function spent running. This entire infrastructure of amazon lambda is managed by AWS. Customer don't get much details that how the lambda system operation works.
Since Amazon Lambda is fully managed service, we can spend more time for application code rather than managing infrastructure.
Benefits of Lambda
Fully managed service
With AWS lambda, functions run on fully managed service. so, we don't have to worry about managing underlying servers. This significantly reduce the cost of managing server, network layers and other infrastructure.
Continuous Auto Scalability
AWS preciously scales function by running triggered event in parallel and process it individually. Hence, there is no pre-scaled pool or no settings to tune, only function will be available whenever the event is triggered.
Pay as you go
Charges for AWS lambda is based on number of functions invocation and their duration to execute the functions. Basically, charges will be high for pick hours and almost zero while no use. Hence, it offers high performance and availability with cost effectiveness. Moreover, AWS offers 1 million function calls free every month.
Rich Ecosystem
Lambda provides a rich ecosystem, supporting developers through AWS Serverless application repository, https://aws.amazon.com/serverless/serverlessrepo/ for discovering, deploying and publishing serverless applications, AWS Serverless Application Model for building serverless applications and integrations with various IDEs.
Common Use Cases
Data Processing
Lambda function is optimised for event based data processing. It is easy to integrate lambda service for specific type of data change in DynamoDB. For example, we can call lambda function whenever any new record created or updated in DynamoDB database for further data process.
Event Driven Requirements
Lambda function is best suit for event driven approach it could be either change in amazon S3, DynamoDB changes or cloud watch event. Hence, It opens an opportunity to trigger and perform several functions like image processing, data processing, notifications and many more based on events.
Scalable Apps
Scalability is the basic need of any application nowadays but making the apps really scalable is very complex and time consuming by managing servers. Amazon lambda makes jobs easy. Each function on the lambda scales as per number of requests. Hence, different part of different APIs scales based on the usage in cost effective manner.
Security and Compliance
Security and compliances are the shared responsibility between AWS lambda and developer. AWS lambda manages underlying infrastructure and foundation services, operating system and application platform. Developers are responsible for the security of the code, storage, sensitive data related to lambda function.
Pricing Model
AWS offers free tier access for 1 year with every account for some of the services. Unlike to other services, Amazon lambda offers free 1 million request and 4,00,000 GB/ second per month.
Aspect | Pricing | Comment |
Requests | $0.20 per 1M requests | The free tier includes 1M requests. |
Function memory and run time | $0.0000166667 per GB-second | The free tier includes 400,000 GB-seconds. |
Inbound network traffic to the Lambda function | Free | - |
Outbound network traffic—within the same AWS region | $0.01/GB | - |
Outbound network traffic—to other AWS regions | $0.02/GB | - |
Outbound network traffic—to public internet | $0.09/GB | Lower pricing per GB applies starting at 10TB/month. |
Amazon API Gateway | $3.50 per 1M requests | If you are using API Gateway with Lambda functions. Lower pricing from 333M requests per month and up. |
Equation to calculate tentative pricing of lambda function
Scalability is the basic need of any application nowadays but making the apps really scalable is very complex and time consuming by managing servers. Amazon lambda makes jobs easy. Each function on the lambda scales as per number of requests. Hence, different part of different APIs scales based on the usage in cost effective manner.
Examples
There is the application which has 20,000 active users and made 150 APIs call each month. For this case, cost will be calculated as below:
-
Xn = 20000 X 150 = 30,00,000 requests / month
As Lambda offers 10,00,000 free requests /month. So price will be calculated on rest of the request which is 20,00,000 (30,00,000 - 10,00,000). -
Suppose, you have assigned 512 Mb for each function and 1 second for execution.
Require memory would be
30,00,000 X 512 / 1024 = 15,00,000 GB / second.
15,00,000 - 4,00,000 = 11,00,000 GB/ second.
11,00,000 * 0.0000166667 USD/GB-sec = 18.33 USD / month. -
API gateway charges : 3.5 USD per million request.
So API gateway cost = 3.5 X 3 = 9.5 USD / month
As per table, cost is 0.20 USD / Million request. So, Xn price would be 20 x 0.20 = 4 USD / Month
Total cost would be = 4 + 18.33 + 9.5 = 31.83 USD
Limitation of Lambda
AWS offers free tier access for 1 year with every account for some of the services. Unlike to other services, Amazon lambda offers free 1 million request and 4,00,000 GB/ second per month.
Cold Start
As mentioned earlier, Lambda function has pay as you go model with some free tier access. This allows significant cost savings on particular kind of requirements and initial period. Cost of lambda increase in proportion to the users of the application. It might be more costlier than EC2 or other cloud provider once app has more traffic.
Code size
As mentioned earlier, Lambda function has pay as you go model with some free tier access. This allows significant cost savings on particular kind of requirements and initial period. Cost of lambda increase in proportion to the users of the application. It might be more costlier than EC2 or other cloud provider once app has more traffic.
Execution time
As mentioned earlier, Lambda function has pay as you go model with some free tier access. This allows significant cost savings on particular kind of requirements and initial period. Cost of lambda increase in proportion to the users of the application. It might be more costlier than EC2 or other cloud provider once app has more traffic.
Log and debugging
As mentioned earlier, Lambda function has pay as you go model with some free tier access. This allows significant cost savings on particular kind of requirements and initial period. Cost of lambda increase in proportion to the users of the application. It might be more costlier than EC2 or other cloud provider once app has more traffic.
Memory
As mentioned earlier, Lambda function has pay as you go model with some free tier access. This allows significant cost savings on particular kind of requirements and initial period. Cost of lambda increase in proportion to the users of the application. It might be more costlier than EC2 or other cloud provider once app has more traffic.
Not always cost effective
As mentioned earlier, Lambda function has pay as you go model with some free tier access. This allows significant cost savings on particular kind of requirements and initial period. Cost of lambda increase in proportion to the users of the application. It might be more costlier than EC2 or other cloud provider once app has more traffic.
AWS dependancy
As mentioned earlier, Lambda function has pay as you go model with some free tier access. This allows significant cost savings on particular kind of requirements and initial period. Cost of lambda increase in proportion to the users of the application. It might be more costlier than EC2 or other cloud provider once app has more traffic.
Limited number of environment supports
As mentioned earlier, Lambda function has pay as you go model with some free tier access. This allows significant cost savings on particular kind of requirements and initial period. Cost of lambda increase in proportion to the users of the application. It might be more costlier than EC2 or other cloud provider once app has more traffic.
Concurrency
As mentioned earlier, Lambda function has pay as you go model with some free tier access. This allows significant cost savings on particular kind of requirements and initial period. Cost of lambda increase in proportion to the users of the application. It might be more costlier than EC2 or other cloud provider once app has more traffic.
Get Free Copy of the Whitepaper
DownloadLet's turn your business idea into reality
Do you want to experience the best in class quality
mobile apps? Send us your inquiry and
one of our executives will catch you up in no time by Call,
Email or Skype.