1
00:00:00,180 --> 00:00:06,930
In this video, we are going to create a subscription to Amazon sans topic, so that means you will

2
00:00:06,930 --> 00:00:07,580
subscribe.

3
00:00:07,620 --> 00:00:10,260
Amazon says to pick from the ADA lambda.

4
00:00:11,060 --> 00:00:14,580
So we have two options to perform this subscription.

5
00:00:14,600 --> 00:00:20,690
So if you open the console, the first option is go to topic and open the topic.

6
00:00:20,690 --> 00:00:24,560
And if you scroll down, go to subscription list and create the subscription.

7
00:00:24,710 --> 00:00:30,080
If you click the create subscription, you can see the topic area and you can select the protocol that

8
00:00:30,080 --> 00:00:38,420
is subscribed to this topic, and you can select a lambda and give the endpoint as a lambda and create

9
00:00:38,430 --> 00:00:39,320
subscription.

10
00:00:39,320 --> 00:00:40,760
This is the first way.

11
00:00:40,760 --> 00:00:45,260
And the second way is go to lambda function and open the our goal function.

12
00:00:45,260 --> 00:00:52,250
And if you come here and see that, we can edit it as a simple notification service, which is the sense

13
00:00:52,250 --> 00:00:58,310
to invoke function asynchronously and process the events so we can add trigger to SMS into our lambda

14
00:00:58,310 --> 00:00:59,000
function.

15
00:00:59,120 --> 00:01:07,430
Click the a trigger and if you select the trigger configuration as a sense, you can see that it is

16
00:01:07,430 --> 00:01:13,100
requiring us to SNS topic that we are going to subscribe and trigger from this place.

17
00:01:13,760 --> 00:01:17,240
You can see in here select the goal notification.

18
00:01:17,240 --> 00:01:19,550
So please set the goal notification.

19
00:01:19,550 --> 00:01:21,860
Give the required topic information in here.

20
00:01:21,890 --> 00:01:24,350
And after that please see this message.

21
00:01:24,350 --> 00:01:30,980
Basically when we add this trigger, Lambda will add the necessary permissions for a sense to invoke

22
00:01:30,980 --> 00:01:32,120
our lambda function.

23
00:01:32,120 --> 00:01:38,360
So if you click the red button, please click this add button and this is going to create a trigger

24
00:01:38,570 --> 00:01:44,240
or lambda function which is the SAS and trigger is successfully added and that means one.

25
00:01:44,270 --> 00:01:49,700
Since invoke our function asynchronously, it needs to invoke Lambda Permissions into resource based

26
00:01:49,700 --> 00:01:52,820
policy with adding trigger sense into lambda function.

27
00:01:52,820 --> 00:01:56,090
This will require permissions automatically to check this.

28
00:01:56,090 --> 00:02:02,990
Please go to the please refresh the page, open the goal function again and go to configuration and

29
00:02:02,990 --> 00:02:04,010
permissions.

30
00:02:04,010 --> 00:02:11,000
If you scroll down, you can see that this time we have a resource based policy and see the statement

31
00:02:11,000 --> 00:02:11,300
ID.

32
00:02:11,300 --> 00:02:20,060
If you click this resource page policy, basically we are giving the permission to the SNS, allowing

33
00:02:20,060 --> 00:02:21,680
to invoke our lambda function.

34
00:02:21,680 --> 00:02:27,110
We can see in here, which is the goal notification can be invoked our lambda function very good.

35
00:02:27,110 --> 00:02:32,510
So these resource based policy added automatically when we are adding trigger to our goal function.

36
00:02:32,510 --> 00:02:36,410
And also we can confirm the subscription from the sense topics.

37
00:02:36,410 --> 00:02:43,850
If you go to Amazon SAS, go to topics and open the go notification and scroll down.

38
00:02:43,850 --> 00:02:49,550
This time you can see the subscription has added successfully and confirmed because the protocol is

39
00:02:49,550 --> 00:02:55,520
lambda function and the endpoint is our lambda function area that we have successfully subscribed these

40
00:02:55,520 --> 00:02:58,280
lambda function to the goal notification.

41
00:02:58,280 --> 00:02:59,840
Amazon sends notification.

42
00:02:59,840 --> 00:03:04,970
So in the next video we are going to develop our lambda function for the incoming event from the topic.
