1
00:00:00,330 --> 00:00:06,690
In this video we are going to create Dynamo DB Klein Node.js Modal for connecting to Dynamo DB.

2
00:00:07,020 --> 00:00:09,360
This section will interact with Dynamic DB.

3
00:00:09,390 --> 00:00:12,870
For all these interactions, we need to connect Dynamo DB.

4
00:00:12,870 --> 00:00:19,590
For that purpose, we should establish Dynamo DB client object instead of creating new client for every

5
00:00:19,590 --> 00:00:20,790
SDK request.

6
00:00:20,820 --> 00:00:27,090
It is best practice to create Node.js module and use this model for every particular SDK commands.

7
00:00:27,630 --> 00:00:33,900
So we are going to create a new folder structure and we are going to create a Node.js module with the

8
00:00:33,900 --> 00:00:37,800
file name of the DB client, which is the Dynamo DB client object.

9
00:00:37,830 --> 00:00:39,420
So let's get started.

10
00:00:39,870 --> 00:00:45,480
If you open the widget to the code, as you can see, I have create a separate lecture folder and create

11
00:00:45,510 --> 00:00:53,550
a DB client JS file, which will be the AH Node.js module that provides to connect Dynamo DB.

12
00:00:53,580 --> 00:00:57,300
And we will create a Dynamo DB client object in this module.

13
00:00:57,450 --> 00:01:03,240
So for that purpose, let me create first and I will explain after that.

14
00:01:03,390 --> 00:01:08,910
So basically we will use these codes when creating Dynamo DB Client object.

15
00:01:09,950 --> 00:01:17,090
Cost the DB client and ne dynamic DB client object and we are placing the region in formation and after

16
00:01:17,090 --> 00:01:24,380
that we are exporting this dynamo DB client object in order to use one interacting dynamo DB from other

17
00:01:24,380 --> 00:01:25,010
models.

18
00:01:25,010 --> 00:01:29,140
So this is the our main code, but there there are some missing parts.

19
00:01:29,150 --> 00:01:35,600
Basically we should add required import statement for Dynamo DB client because this comes from the SDK

20
00:01:35,600 --> 00:01:36,140
package.

21
00:01:36,140 --> 00:01:42,260
For that purpose you can come here and see there is no suggestion, but I know that we should import

22
00:01:42,260 --> 00:01:50,690
required statement which is the Dynamo DB client dynamo DB package including the Dynamo DB client object

23
00:01:50,690 --> 00:01:52,580
from this HC package.

24
00:01:52,580 --> 00:01:57,740
So this is important that we are going to use dynamo DB client object when interacting Dynamo DB.

25
00:01:57,770 --> 00:02:00,500
So that's why we have imported this statement.

26
00:02:00,500 --> 00:02:02,030
But one more thing.

27
00:02:02,030 --> 00:02:04,340
We should provide the region information.

28
00:02:04,340 --> 00:02:08,720
This is also important client object required for the region information.

29
00:02:08,720 --> 00:02:15,380
If you open the management console and come here, if you expand this section as you can see that I

30
00:02:15,380 --> 00:02:21,890
am using us is to you can check from your console and you can set your region information according

31
00:02:21,890 --> 00:02:24,110
to that, come back to our code window.

32
00:02:24,110 --> 00:02:31,090
So basically I'm going to put region variable in here and set the US ista.

33
00:02:31,190 --> 00:02:38,150
So so please save this file and finalize our Node.js module, which is the Dynamo DB client.

34
00:02:38,360 --> 00:02:43,460
As you can see that we have created Node.js module for Dynamo DB connections with creating any instance

35
00:02:43,460 --> 00:02:45,260
of Dynamo DB Client Object.

36
00:02:45,290 --> 00:02:49,550
This client object will use every interaction with our SDK example.

37
00:02:49,580 --> 00:02:56,420
Now we are ready for the all of our use cases which use cases we will create and using the tables,

38
00:02:56,420 --> 00:03:02,480
reading and writing, single item reading, writing batch items, creating and scanning on dynamo DB

39
00:03:02,480 --> 00:03:04,910
table and perform the particle operations.
