Amazon Web Services - Lambda | Introduction to Amazon Web Services(AWS) - Software Development PDF Download

AWS Lambda is a responsive cloud service that inspects actions within the application and responds by deploying the user-defined codes, known as functions. It automatically manages the compute resources across multiple availability 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.

Amazon Web Services

Step 3 − Select a Blueprint (optional) and click the Skip button.

Lambda

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.

Configure Function


Lambda Function Handler

Step 5 − Click the Next button and verify your details.

Step 6 − Click 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.

Amazon DynamoDB

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 click the Monitoring tab. Then click the View Logs in CloudWatch.

Monitoring

Benefits of AWS Lambda

Following are some of the benefits of using Lambda tasks −

  • Lambda tasks need not to be registered like 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 limits.

Throttle Limit

The throttle limit is 100 concurrent Lambda function executions per account and is applied 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 limit is reached, then it returns a throttling error having an error code 429. After 15-30 minute you can start work again. The throttle limit can be increased by contacting AWS support center.

Resources Limit

The following table shows the list of resources limits for a Lambda function.

ResourceDefault Limit

Ephemeral disk capacity ("/tmp" space)512 MB
Number of file descriptors1,024
Number of processes and threads (combined total)1,024
Maximum execution duration per request300 seconds
Invoke request body payload size6 MB
Invoke response body payload size6 MB

Service Limit

The following table shows the list of services limits for deploying a Lambda function.

ItemDefault 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 region1.5 GB
Number of unique event sources of the Scheduled Event source type per account50
Number of unique Lambda functions you can connect to each Scheduled Event5

For latest updated limit structure & more information, visit − https://docs.aws.amazon.com/lambda/latest/dg/limits.html/

The document Amazon Web Services - Lambda | Introduction to Amazon Web Services(AWS) - Software Development is a part of the Software Development Course Introduction to Amazon Web Services(AWS).
All you need of Software Development at this link: Software Development
24 docs

Top Courses for Software Development

FAQs on Amazon Web Services - Lambda - Introduction to Amazon Web Services(AWS) - Software Development

1. What is Amazon Web Services (AWS) Lambda?
AWS Lambda is a serverless computing service provided by Amazon Web Services (AWS). It allows developers to run their code without provisioning or managing servers. The service automatically scales the code in response to incoming requests, ensuring high availability and cost efficiency.
2. How does AWS Lambda work?
AWS Lambda allows developers to upload their code in the form of functions, written in supported programming languages such as JavaScript, Python, and Java. When an event triggers the function, such as an incoming request to an API endpoint, Lambda automatically provisions the necessary compute resources to execute the code. After the code execution, Lambda releases the resources, making it a highly scalable and cost-effective solution.
3. What are the benefits of using AWS Lambda?
AWS Lambda offers several benefits, including: - No server management: Developers can focus on writing code without worrying about server provisioning, maintenance, and scalability. - Cost efficiency: With Lambda, developers only pay for the compute time consumed during code execution, eliminating the need for continuous server expenses. - Scalability: Lambda automatically scales the code in response to incoming events, ensuring high availability and optimal performance. - Flexibility: Developers can use Lambda to build a wide range of applications, from simple API endpoints to complex event-driven architectures.
4. Can I use AWS Lambda with other AWS services?
Yes, AWS Lambda seamlessly integrates with other AWS services, allowing developers to build comprehensive solutions. For example, Lambda can be used to process events from Amazon S3, trigger code execution based on changes in an Amazon DynamoDB table, or respond to API Gateway requests. This integration enables developers to create powerful and scalable applications by combining various AWS services.
5. How can I monitor and troubleshoot my AWS Lambda functions?
AWS provides several monitoring and troubleshooting tools for Lambda functions. Developers can use Amazon CloudWatch to monitor the performance metrics and logs of their functions. CloudWatch provides insights into the function's execution duration, error rates, and resource utilization. Additionally, AWS X-Ray can be used to trace and analyze the performance of distributed applications that use Lambda functions. These tools help in identifying and resolving any issues or bottlenecks in the code execution.
24 docs
Download as PDF
Explore Courses for Software Development exam

Top Courses for Software Development

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

study material

,

Extra Questions

,

Amazon Web Services - Lambda | Introduction to Amazon Web Services(AWS) - Software Development

,

Free

,

mock tests for examination

,

shortcuts and tricks

,

Amazon Web Services - Lambda | Introduction to Amazon Web Services(AWS) - Software Development

,

Semester Notes

,

Amazon Web Services - Lambda | Introduction to Amazon Web Services(AWS) - Software Development

,

video lectures

,

Sample Paper

,

Summary

,

Exam

,

Viva Questions

,

practice quizzes

,

past year papers

,

MCQs

,

Previous Year Questions with Solutions

,

Objective type Questions

,

ppt

,

Important questions

,

pdf

;