What is a lambda function?

The AWS Lambda can automatically execute code in response to various events, such as HTTP request through Amazon API Gateway.

Code that runs on AWS Lambda is called a “Lambda Function”. AWS Lambda natively supports Java, Go, PowerShell, Node.js, C#, Python and, Ruby code and provides a runtime API that allows you to use any additional programming languages to create your functions.

How to create a lambda function?

Open the Functions Page in the Lambda console and click on create function.

Select Create from scratch and in the basic information, write the name of the function and the language it will use. In this case, I am using Node.js then click on the button “Create a function”.

Lambda creates a Node.js function and an execution role that grants the function permission to upload logs. The Lambda function assumes the execution role when you invoke your procedure and uses the execution role to create credentials for the AWS SDK and to read data from event sources.

When we click on the test button, the following screen appears below. In the Events template, we leave the default “hello-world” and put a name to the Event that we will create. Can carry out up to 11 events to perform various parameters. In our case, we will leave the parameters as they are, and we will only do this test event.

When we click on the “create” button, it generates the MyHelloWorld event and puts it in a list, ready to test.

We finished with the test executed correctly, and we see the result that we had in the lambda function, a JSON from hello world.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s