Search This Blog

Saturday, December 10, 2016

Part - 9 - AWS - Lambda (Stateless computing)

Lambda (Stateless computing)








·        AWS Lambda service allows you to run code without having to worry about provisioning any underlying resources (such as virtual machines, databases etc.)
·        AWS Lambda is a server-less compute service that runs your code in response to events and automatically manages the underlying compute resources for you.
·        You can use AWS Lambda to extend other AWS services with custom logic, or create your own back-end services that operate at AWS scale, performance, and security.

What is Lambda?

AWS Lambda is a compute service where you can upload your code and create a Lambda function. AWS Lambda takes care of provisioning and managing the servers that you use to run the code. You don't have to worry about operating systems, patching, scaling, etc. You can use Lambda in the following ways:
·        As an event-drive compute service where AWS Lambda runs your code in response to events. These events could be changes to data in an Amazon S3 bucket or an Amazon DynamoDB table.
·        As a compute service to run your code in response to HTTP requests using Amazon API Gateway or API Calls made using AWS SDKs. This is what we use at A Cloud Guru.

What Actually Is It?

·       Data Centers
·        Hardware
·        Assembly Code/Protocols
·        High level Languages
·        Operating Systems
·        AWS API's
·        AWS Lambda
Lambda runs your code on high-availability compute infrastructure and performs all the administration of the compute resources, including server and operating systems maintenance, capacity provisioning and automatic scaling, code and security patch deployment, and code monitoring and logging.
All you need to do is supply the code.

What Events Trigger Lambda?

You can use AWS Lambda to respond to table updates in Amazon DyanmoDB, modifications to objects in Amazon S3 buckets, messages arriving in an Amazon Kinesis stream, AWS API call logs created by AWS CloudTrail, and customer events from mobile applications, web applications, or other web services.
·        Supported Programming Languages -  Javascript, Python, Node.js
·        AWS Lambda is designed to provide 99.99% availability for both the service itself and for the functions its operates.

Lambda Pricing:

·        Requests:
o   First 1 million requests are free
o   $0.20 per 1 million requests there after
·        Duration
o   Duration is calculated from the time your code begins executing until it returns or otherwise terminates, rounded up to the nearest 100ms. You allocate to your function. You are charges $0.00001667 for every GB-second used.
·        Free Tier
o   1M free requests per month and 400,000 GB-seconds of compute time per month. The memory size you choose for your Lambda functions determines how long they can run in the free tier. The Lambda free tier does not automatically expire at the end of your 12 months AWS Free Tier term, but is available to both existing and new AWS customer indefinitely. 



If you allocated 512MB of memory to your function, executed it 3 million times in one month, and it ran for 1 second each time, your charges would be calculated as follows:
·        The Monthly compute price is $0.00001667 per GB-s and the free tier provides 400,000 GB-s.
·        Total compute (seconds)=3M*(1s)-3,000,000 second
·        Total compute (GB-s)=3,000,000*512MB/1024=1,500,00 GB-s
·        Total Compute - Free tier compute = Monthly billable compute GB-s
·        1,500,000 GB-s - 400,000 free tier compute = Monthly billable compute GB-s
·        Monthly compute charges = 1,100,000 * $0.00001667 = $18.34 $18.34 

Why is Lambda Cool?

·        NO Servers!
·        Continuous Scaling

·        Super Super Super Che

2 comments: