In this video, we are going to start developing our lambda function for incoming event from the SNS
topic.
When we developing our lambda function, we should know that incoming event JSON object from the Amazon
SNS topic.
There are several ways to know and we should check the test template on SNS notification from the lambda.
So if you open the lambda function and go to test and if you scroll down you can see that we have different,
different templates that we can see in this dropdown.
And if you search for the SNS, you can see the SNS topic notification to lambda function is come in
here.
If you select this template, we can see the potential incoming event JSON from the SNS.
I'm going to copy this even JSON object and paste into our visual pseudocode.
As you remember that we have created a separate lecture and section folders.
So in this section we got the incoming event JSON object from the SNS topic to a lambda.
We can see that we have a records array and every array item including the SNS topic and even source
is a SNS and you can see the event subscription.
Aaron The SNS related information is under the SNS and you can get the type message ID topic and subject
message and so on.
So this is the incoming event JSON file from the SNS topic to Lambda function.
And after that we can develop our lambda function if you come here and create a new index JS file,
let me create index.
JS Well, basically we will create a lambda function in here to make it basic lambda implementation.
I'm going to log the incoming message from the SMS topic.
So basically you can come here and see the event JSON.
So if you come to spot and see the message, I'm going to get the message and log the message in the
lambda function.
So if you come back to our lambda function and develop lambda function in here.
So basically this is the one handed method and the first line of code, we are logging the incoming
event from the SMS topic and here you can see the our business logic.
We basically get the event that records zero start message and get the message from the incoming event
from the SMS topic and log this message into our cloud logs.
Okay, this is the our lambda function and we are going to deploy this function to do so.
Please open the a lambda and go to code part and copy codes from our application and paste into the.
A Lambda function.
Since this will trigger asynchronously, we don't return any response for our lambda function.
I'm going to deploy this function and we have successfully deployed our function.
So this is the asynchronous invocation.
We don't return anything.
To be simple, I only log the incoming message, but we will see some complex handle up in the next
section.
But now let's see how we can test and see.
Incoming message from the lambda.