In this video, we are going to create a subscription to Amazon sans topic, so that means you will
subscribe.
Amazon says to pick from the ADA lambda.
So we have two options to perform this subscription.
So if you open the console, the first option is go to topic and open the topic.
And if you scroll down, go to subscription list and create the subscription.
If you click the create subscription, you can see the topic area and you can select the protocol that
is subscribed to this topic, and you can select a lambda and give the endpoint as a lambda and create
subscription.
This is the first way.
And the second way is go to lambda function and open the our goal function.
And if you come here and see that, we can edit it as a simple notification service, which is the sense
to invoke function asynchronously and process the events so we can add trigger to SMS into our lambda
function.
Click the a trigger and if you select the trigger configuration as a sense, you can see that it is
requiring us to SNS topic that we are going to subscribe and trigger from this place.
You can see in here select the goal notification.
So please set the goal notification.
Give the required topic information in here.
And after that please see this message.
Basically when we add this trigger, Lambda will add the necessary permissions for a sense to invoke
our lambda function.
So if you click the red button, please click this add button and this is going to create a trigger
or lambda function which is the SAS and trigger is successfully added and that means one.
Since invoke our function asynchronously, it needs to invoke Lambda Permissions into resource based
policy with adding trigger sense into lambda function.
This will require permissions automatically to check this.
Please go to the please refresh the page, open the goal function again and go to configuration and
permissions.
If you scroll down, you can see that this time we have a resource based policy and see the statement
ID.
If you click this resource page policy, basically we are giving the permission to the SNS, allowing
to invoke our lambda function.
We can see in here, which is the goal notification can be invoked our lambda function very good.
So these resource based policy added automatically when we are adding trigger to our goal function.
And also we can confirm the subscription from the sense topics.
If you go to Amazon SAS, go to topics and open the go notification and scroll down.
This time you can see the subscription has added successfully and confirmed because the protocol is
lambda function and the endpoint is our lambda function area that we have successfully subscribed these
lambda function to the goal notification.
Amazon sends notification.
So in the next video we are going to develop our lambda function for the incoming event from the topic.