Cloud Computing
Before proceeding with AWS Lambda, let’s first understand its domain, Cloud Computing, where AWS has originated from.
Cloud Computing is simply a practice of using a network of remote servers hosted on the Internet to store, manage, and process data, rather than using a local server or a personal computer.
But, why are we talking about AWS when there are numerous other Cloud Computing vendors? Here are some of the major players in the marketplace when it comes to Cloud Computing.
If we talk of services, AWS Compute plays a major role while we work with AWS as it provides us secure and resizable computing capacity on the cloud.
What is AWS Lambda?
The Lambda functions can perform any kind of computing task, from serving web pages and processing streams of data to calling APIs and integrating with other AWS services.
AWS Lambda is a Function-as-a-service (FaaS) computing platform provided by AWS. FaaS provides a computing platform to execute code in the cloud. As in any serverless system, it abstracts away the complexities of provisioning and managing a cloud infrastructure.
How does AWS Lambda work?
Before we are going further for how AWS Lambda works, first, we have to understand a few aspects of the Lambda-based application.
Building Blocks
- Lambda function: Whatever custom codes and libraries that we create are called a function.
- Event source: Any AWS or custom service that triggers our function and helps in executing its logic
- Log streams: Lambda monitors our function automatically and one can view its metric on CloudWatch, directly, but we can also code our function in a way that it provides us custom logging statements to let us analyze the flow of execution and performance of our function to check if it’s working properly.
Using AWS Lambda with S3
- First, the user creates a Lambda function.
- The user uploads the code to the Lambda function.
- Then, the user uploads the image from the website to the S3 bucket as an object.
- After receiving the object, the S3 bucket triggers the Lambda function.
- Then, the Lambda function does its job by resizing the image in the back-end and sends a successful completion email through SQS.
Each n every Lambda function runs in its own container. When a function is created, Lambda packages it into a new container and then executes that container on a multi-tenant cluster of machines managed by AWS. Before the functions start running, each function’s container is allocated its necessary RAM and CPU capacity. Once the functions finish running, the RAM allocated at the beginning is multiplied by the amount of time the function spent running. The customers then get charged based on the allocated memory and the amount of run time the function took to complete.
The entire infrastructure layer of AWS Lambda is managed by AWS. Customers don’t get much visibility into how the system operates, but they also don’t need to worry about updating the underlying machines, avoiding network contention, and so on—AWS takes care of this itself.
And since the service is fully managed, using AWS Lambda can save you time on operational tasks. When there is no infrastructure to maintain, you can spend more time working on the application code—even though this also means you give up the flexibility of operating your own infrastructure.
One of the distinctive architectural properties of AWS Lambda is that many instances of the same function, or of different functions from the same AWS account, can be executed concurrently. Moreover, the concurrency can vary according to the time of day or the day of the week, and such variation makes no difference to Lambda—you only get charged for the compute your functions use. This makes AWS Lambda a good fit for deploying highly scalable cloud computing solutions.
AWS Pricing
A number of AWS Lambda executions are included with the AWS Free Tier with every AWS account. Unlike some other services, the Lambda free tier isn’t limited to 12 months. Both existing and new accounts get 1 million AWS Lambda requests plus 400,000 GB-seconds per month — Lambda’s measure of function runtime and the memory allocated to a function.
Beyond the free tier the pricing for AWS Lambda is as follows:
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. |
For each execution, the total cost will be the sum of all applicable factors, including the cost per request, the memory and run time, and the network traffic.
Comments
Post a Comment