Prishita Kapoor
3 min readApr 23, 2022

--

AWS Lambda is a responsive cloud service that inspects actions within the application and responds by deploying the user-defined codes, known as functions.

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?

Step 1 − Sign in to AWS account.

Step 2 − Select Lambda from AWS services section.

Step 3 − Select a Blueprint (optional) and click 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 − 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.

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.

Benefits of AWS Lambda

  • 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.

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

--

--

Prishita Kapoor

I endeavor to fuse academic knowledge with experience for the growth of the world while enhancing my engineering and interpersonal skills.