In this video, we are going to develop a lambda function handle in Node.js.
So we are in the second step.
We have created execution role and now we are going to create a function code that will function code.
Okay, let's get started.
Please open the visual code and create a new lecture.
And as you can see that before we creating this any section, we have created a separate lecture.
Now we will use Node.js runtime for our lambda functions and it is required to 100 method that we will
develop in this video.
The lambda function handler is the method in our function code that processed the events incoming events.
When our function is invoked, Lambda runs the handler method.
So when the handler exits or returns a response, it becomes available to handle another event.
So this is the basic execution principle for the lambda functions.
For that purpose, I'm going to create a new file which is the index.
JS This will be include our Lambda Handler code.
So in these index JS we will develop basic Lambda Code.
I'm going to developing our basic lambda code.
You can see in here I have copy and paste for the export standard by this method name we are exporting
the handle method and this will be getting event parameter for the incoming event and we basically lock
these incoming events and after that we will return the response.
Hello from Lambda.
Okay, so this is the basic lambda code that looks to incoming event and return success response with
the hello message.
Basically this example function log the contents and log the event, incoming event object and return
back to the this string response as a body.
And in our case our finding is indexed.
JS And our method name is the 100 method.
So this is the export standard.
So the default values is this name in the console.
Also we can see this index file and 100 method.
So basically the runtime passes three arguments to the 100 method.
The first parameters is event and event object, which contains the information from the invoker and
the IMO capacities.
Information is adjacent format string one invoke this function and the runtime is converts to this object.
One Natively service is invoked our function.
The event structure varies by the invoke or services.
For example, this event object will be differentiate when it invokes from the Amazon S3 or API gateway.
We will see these different events in Lambda function in the upcoming sections.
But basically in this video we have developed our Lambda function code with the default code window
and also you can check the default method from the our last created lambda function.
If you open the my function and contact window, you can see that this is the default hundred method
which is generated from the ADA is lambda.
So we have using the same template for our newly created lambda function.