Amazon Web Services Basics
- AWS - Account
- AWS - Console Mobile App
- AWS - Management Console
- AWS - Basic Architecture
- AWS - Cloud Computing
Amazon Computer Services
Amazon Network Services
Amazon Storage Services
Amazon Database Services
Amazon Analytics Services
Amazon Application Services
Amazon Web Services Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Amazon Web Services - Lambda
AWS Lambda is a responsive cloud service that inspects actions within the apppcation and responds by deploying the user-defined codes, known as functions. It automatically manages the compute resources across multiple availabipty zones and scales them when new actions are triggered.
AWS Lambda supports the code written in Java, Python and Node.js, and the service can launch processes in languages supported by Amazon Linux (includes Bash, Go & Ruby).
Following are some recommended tips while using AWS Lambda.
Write your Lambda function code in a stateless style.
Never declare any function variable outside the scope of the handler.
Make sure to have a set of +rx permissions on your files in the uploaded ZIP to ensure Lambda can execute code on your behalf.
Delete old Lambda functions when no longer required.
How to Configure AWS Lambda?
Follow these steps to configure AWS Lambda for the first time.
Step 1 − Sign in to AWS account.
Step 2 − Select Lambda from AWS services section.
Step 3 − Select a Blueprint (optional) and cpck the Skip button.
Step 4 − Provide the necessary details to create a Lambda function as shown in the following screenshot and paste the Node.js code that will be triggered automatically whenever a new item is added in DynamoDB. Select all the required permissions.
Step 5 − Cpck the Next button and verify your details.
Step 6 − Cpck the Create Function button.
Now, when we select the Lambda service and select the Event Sources tab, there will be no records. Add at least one source to the Lambda function to work. Here, we are adding DynamoDB Table to it.
We have created a table using DynamoDB (we will discuss this in detail in DynamoDB chapter).
Step 7 − Select the stream tab and associate it with the Lambda function.
You will see this entry in Event Sources Tab of Lambda Service page.
Step 8 − Add some entries into the table. When the entry gets added and saved, then Lambda service should trigger the function. It can be verified using the Lambda logs.
Step 9 − To view logs, select the Lambda service and cpck the Monitoring tab. Then cpck the View Logs in CloudWatch.
Benefits of AWS Lambda
Following are some of the benefits of using Lambda tasks −
Lambda tasks need not to be registered pke Amazon SWF activity types.
We can use any existing Lambda functions that you’ve already defined in workflows.
Lambda functions are called directly by Amazon SWF; there is no need design a program to implement and execute them.
Lambda provides us the metrics and logs for tracking function executions.
AWS Lambda Limits
Following are the three types of Lambda pmits.
Throttle Limit
The throttle pmit is 100 concurrent Lambda function executions per account and is appped to the total concurrent executions across all functions within a same region.
The formula to calculate the number of concurrent executions for a function = (average duration of the function execution) X (number of requests or events processed by AWS Lambda).
When throttle pmit is reached, then it returns a throttpng error having an error code 429. After 15-30 minute you can start work again. The throttle pmit can be increased by contacting AWS support center.
Resources Limit
The following table shows the pst of resources pmits for a Lambda function.
Resource | Default Limit |
---|---|
Ephemeral disk capacity ("/tmp" space) | 512 MB |
Number of file descriptors | 1,024 |
Number of processes and threads (combined total) | 1,024 |
Maximum execution duration per request | 300 seconds |
Invoke request body payload size | 6 MB |
Invoke response body payload size | 6 MB |
Service Limit
The following table shows the pst of services pmits for deploying a Lambda function.
Item | Default Limit |
---|---|
Lambda function deployment package size (.zip/.jar file) | 50 MB |
Size of code/dependencies that you can zip into a deployment package (uncompressed zip/jar size) | 250 MB |
Total size of all the deployment packages that can be uploaded per region | 1.5 GB |
Number of unique event sources of the Scheduled Event source type per account | 50 |
Number of unique Lambda functions you can connect to each Scheduled Event | 5 |
For latest updated pmit structure & more information, visit −
Advertisements