In this video, we are going to develop our lambda function for pulling Q message with event source
mapping invocation.
So as we know that when we implement in architecture on a list, the first step is create infrastructure
on the cloud that we finished this step.
And now the second step is the will of Lambda Code for interacting Amazon SGS.
So now we will develop our Lambda function code, but before that we should understand which event will
be triggered or a lambda function from the Amazon queue.
So for that purpose we have a documentation that you can see that we have example Amazon is message
event.
If you scroll down, you can see that we have a records array and we have every item listed in here
which including the message ID received handle and so on.
And we will follow these records and incoming event JSON object when developing our function.
And also we can check from the lambda functions.
If you open the lambda function, come to test and if you scroll down and search for the template and
I'm searching from the case, if you search for the case, you can see that an example, even JSON object
that we can copy and open our pseudocode and I have create a separate lecture and section folder.
I'm going to create an event JSON object and paste in here and save this file.
Okay, very good.
So basically we have a records array and every item has including these attributes to do.
So I'm going to create an index JS file and implement these lambda function in here.
If you come here, you can see that very basic implementation in here.
This is the lambda function and we basically log incoming event an object and after that we will iterate
over the records of the event and we will get the record item in particular, record item in the records
array.
And basically we get the body information and log the body information.
If we check the event JSON object, we can see the body information including Hello from SXSW.
This is an example body of the our incoming event object from the case.
So we get the body object and log this what the object and return aim to object since this is the event
source mapping.
First of all the item pulled from the lambda function and trigger the function itself synchronously.
So that's why I'm turning an object.
Okay, very good.
So you can copy all this code and go to the waste management environment, go to lambda function.
We are going to deploy our code with manually remove this code and paste in here and click the deploy
button.
So we have successfully deployed our function manually.
As you can see that we developed lambda function for pulling message with event source invocation.