1
00:00:00,810 --> 00:00:09,780
I hope you are able to figure out a possible approach to update the clouds which is next on the fly.

2
00:00:11,100 --> 00:00:14,520
Solution is simple very simple.

3
00:00:14,550 --> 00:00:23,560
And we have used this process already a couple of times in this course and you might have already guessed

4
00:00:23,560 --> 00:00:24,110
it.

5
00:00:24,440 --> 00:00:33,900
We're going to is dynamo Davies dreams along with Louderback trigger to upload the changes to Klaus's.

6
00:00:34,190 --> 00:00:35,280
So let's do that.

7
00:00:40,820 --> 00:00:49,200
Our Global TV stable already has streams and Nabl with old and new images.

8
00:00:49,490 --> 00:00:58,220
We just need to create a new land at Treanor to upload the changes to cloud search said let's create

9
00:00:58,220 --> 00:00:59,100
a new folder

10
00:01:01,740 --> 00:01:08,980
open it the code and let's initialize a new mode project with NPR and

11
00:01:12,060 --> 00:01:14,210
just like that.

12
00:01:14,410 --> 00:01:18,380
Install a business SDK as usual

13
00:01:21,610 --> 00:01:29,430
create an index or just fine to hold our land function inside the file reference.

14
00:01:29,480 --> 00:01:31,810
The as the.

15
00:01:44,640 --> 00:01:46,800
And initialize an object.

16
00:01:46,840 --> 00:01:49,680
Our Lives SEAGE to make less

17
00:01:55,230 --> 00:01:56,220
this time.

18
00:01:56,220 --> 00:02:05,520
The End Point is going to be the document and point and not the search point because we want to upload

19
00:02:05,520 --> 00:02:16,030
documents to ourselves and Mark actually from the searches said Copy the document and point from cloud

20
00:02:16,030 --> 00:02:20,460
search console and pasted in here.

21
00:02:21,790 --> 00:02:28,210
Then let's write the handler function for lambda a space dog handler.

22
00:02:28,560 --> 00:02:40,140
You rant on text and call the and the dynamo these three red cards will be available in the event.

23
00:02:40,160 --> 00:02:48,640
Dark red cards at the age of 10 when the intervening item data in a format are required by a large search

24
00:02:48,700 --> 00:02:49,540
API.

25
00:02:50,540 --> 00:02:54,330
And we can do that using the map function.

26
00:02:54,440 --> 00:03:06,800
Max function simply is a custom function on every element of an entity and it is a new we are going

27
00:03:06,800 --> 00:03:14,460
to use the asynchronous version of the map function using the a saying and more.

28
00:03:14,570 --> 00:03:23,050
You said let's install a sing using and install a single dash dash.

29
00:03:23,120 --> 00:03:28,200
Save and then run city code

30
00:03:33,070 --> 00:03:38,380
then inside the Landauer handler we can call the map method

31
00:03:42,280 --> 00:03:49,730
a saying door map B and A which is event to dart cars.

32
00:03:49,750 --> 00:03:57,020
In our case I already function that takes in car and call back

33
00:04:00,000 --> 00:04:01,740
let's call it call back.

34
00:04:01,740 --> 00:04:14,240
Matt just to differentiate it from the main call that then the final callback are the function louses

35
00:04:14,360 --> 00:04:19,550
API provides two operations add and delete.

36
00:04:19,610 --> 00:04:31,220
We use the add to add new documents or to update existing ones and then later remove existing documents

37
00:04:31,220 --> 00:04:34,630
from the clouds in less.

38
00:04:34,640 --> 00:04:44,430
So for each record we specify the operation type on the or delete followed by the unique ID of the document.

39
00:04:45,460 --> 00:04:56,470
And then the data base ascii value is in case there is see or room event from this train we issue a

40
00:04:56,520 --> 00:05:02,480
delete operation as we issue an ad operation.

41
00:05:02,550 --> 00:05:13,190
Now if you run a search on Blough search you will notice that allowed search generates a unique ID.

42
00:05:13,210 --> 00:05:24,120
We are trying to move the item using the primary key to partition key and hash key separated by an underscore

43
00:05:24,130 --> 00:05:24,970
correct.

44
00:05:27,400 --> 00:05:37,070
So in our function we must force the ID in the same format say for a car door event name equals the

45
00:05:37,110 --> 00:05:37,900
No.

46
00:05:38,110 --> 00:05:51,700
Then we turn the call back map with an object with type delete and tidy as user ID and time stamp call

47
00:05:51,800 --> 00:05:59,280
calculated by an honest less populated user ID and time.

48
00:06:16,170 --> 00:06:17,700
Just like that.

49
00:06:23,020 --> 00:06:36,150
In the event name is anything Bartiromo we issue an the races in that as long callback map and return

50
00:06:36,150 --> 00:06:50,250
the object with type and an ID as ID and the leaves to add licet these is an object with key value pairs

51
00:06:50,310 --> 00:07:01,470
are dynamo Leavey item attributes Bede's should be a rainbow in the new image attribute in the event

52
00:07:01,470 --> 00:07:02,310
stream.

53
00:07:02,340 --> 00:07:14,480
So let's declare a variable to point to new image and then we can use it to populate all the item to

54
00:07:14,490 --> 00:07:24,860
use these will be the column names from Blauser and Raley's will be the corresponding Raley's from the

55
00:07:24,860 --> 00:07:26,830
dynamo the item

56
00:08:02,940 --> 00:08:12,420
now we should have the resulting batch of documents to be uploaded rentable in the SOS object in the

57
00:08:12,420 --> 00:08:13,910
final callback.

58
00:08:15,830 --> 00:08:28,280
The last step is to call the upload documents method or the cloud system and class so see as the dot

59
00:08:28,560 --> 00:08:32,360
load documents caroms callback

60
00:08:43,300 --> 00:08:49,840
and inside the parents we have to specify Content-Type applications.

61
00:08:49,900 --> 00:08:50,650
Jason

62
00:08:56,590 --> 00:09:05,290
and document that would be the results object converted to Jason using Jason.

63
00:09:05,320 --> 00:09:06,710
There are springeth

64
00:09:12,820 --> 00:09:17,220
Arlanda operation is ready let's create a package.

65
00:09:17,260 --> 00:09:22,310
As usual then the contents of the folder

66
00:09:26,770 --> 00:09:33,560
and then remove the age of us as the Kapler ran inside the margins for

67
00:09:39,540 --> 00:09:42,170
open the dynamo console.

68
00:09:42,180 --> 00:09:49,240
And on that triggers tab key to the new fashion.

69
00:09:49,510 --> 00:09:53,380
And it take us to the land console.

70
00:10:09,780 --> 00:10:15,720
I'm going to name the function as a date cloud sewage from Diabaly

71
00:10:18,560 --> 00:10:20,490
we'll create a new role.

72
00:10:23,410 --> 00:10:26,810
Call it land or cloud message.

73
00:10:26,890 --> 00:10:27,240
Dan

74
00:10:30,620 --> 00:10:33,850
Roop policy document and they did.

75
00:10:33,950 --> 00:10:42,650
And I'm going to Baystate and Jason policy right Grant permission to land are allowed to charge a large

76
00:10:42,760 --> 00:10:54,470
surge and ultimately the Danimal streams I have attached the policy Jason document in the sources section

77
00:10:54,560 --> 00:10:57,930
of this video for your use as well.

78
00:10:59,490 --> 00:11:02,920
And enable the trigger and a function

79
00:11:08,380 --> 00:11:11,540
and then we simply upload our code here.

80
00:11:18,680 --> 00:11:31,510
Let's increase the timeout 2 to 1 minute and save the function.

81
00:11:31,610 --> 00:11:35,870
Now to test if this works I'm going to delete.

82
00:11:35,890 --> 00:11:48,270
Am I to duplicate any existing item and also modify an existing item to see if the change reflects in

83
00:11:48,290 --> 00:11:55,360
clouds which an ongoing in the user id be formulating.

84
00:11:55,740 --> 00:12:08,470
And then this item that's duplicated is and change the partition key to some random data.

85
00:12:08,650 --> 00:12:12,480
Note the new p.

86
00:12:12,640 --> 00:12:16,310
And then let's also modify another item.

87
00:12:24,810 --> 00:12:29,150
And neighed the partition key is that.

88
00:12:29,370 --> 00:12:30,000
All right.

89
00:12:30,130 --> 00:12:31,540
Let's see.

90
00:12:31,660 --> 00:12:41,940
The land functions if you did all that Krieger's stab hits with fresh and you can see that last result

91
00:12:42,090 --> 00:12:44,960
was successful.

92
00:12:45,080 --> 00:12:48,460
And if you look at cloud watch longs

93
00:12:51,380 --> 00:12:59,240
we see that one item was deleted and two were added are dated.

94
00:12:59,750 --> 00:13:03,870
Let's finally verify this from Plow's search.

95
00:13:03,870 --> 00:13:09,390
Consul the first search for the delete key.

96
00:13:09,390 --> 00:13:18,020
Now we see that there are no reasons searching by the other two.

97
00:13:18,030 --> 00:13:21,970
He should give us the latest results.

98
00:13:25,480 --> 00:13:26,200
And

99
00:13:32,830 --> 00:13:43,230
what Austin said that able to update our search results on the fly using diamante these screams and

100
00:13:43,350 --> 00:13:49,800
land outriggers that completes our them or our search.

101
00:13:49,810 --> 00:13:56,390
Next up is cloud watch and we're very familiar with cloud watch.

102
00:13:56,600 --> 00:14:00,110
There is a lot in this course.

103
00:14:00,630 --> 00:14:08,980
Yes in the next section we're going to take a closer look at the cloud what there is and use it more

104
00:14:09,070 --> 00:14:10,370
effectively.
