1
00:00:00,270 --> 00:00:07,980
In this video, we are going to create our first Amazon Dynamic DB table with using a measurement console.

2
00:00:08,310 --> 00:00:09,890
You can see the image on the slide.

3
00:00:09,900 --> 00:00:12,570
We are at the beginning of our use cases.

4
00:00:12,570 --> 00:00:18,750
The first use case is create a table so we will implement a create table command with using ADD this

5
00:00:18,810 --> 00:00:21,210
measurement console to the Dynamo DB.

6
00:00:21,420 --> 00:00:22,950
So let's get started.

7
00:00:23,100 --> 00:00:28,350
To do that, please open a management console and search for the Dynamo DB.

8
00:00:29,150 --> 00:00:36,320
And you can put a star in here in order to add to favorites Dynamo DB and collected Dynamo DB page.

9
00:00:37,820 --> 00:00:40,380
So this is the default page of IMDB.

10
00:00:40,430 --> 00:00:45,260
Since we have no any tables, we see the default page.

11
00:00:45,290 --> 00:00:50,360
If we have some tables on this list, we will see the table list in our application.

12
00:00:50,510 --> 00:00:55,940
So if you scroll down, this is the general welcome page, which includes good resource and links,

13
00:00:55,940 --> 00:01:02,090
links about the documentation and resources we can see in here, use cases, links and so on.

14
00:01:02,150 --> 00:01:07,850
So basically in this video, we are going to create a table, dynamic table and see the core concepts

15
00:01:07,850 --> 00:01:09,470
over the dynamic DB table.

16
00:01:09,650 --> 00:01:13,970
So in this step, we should design our table and table attributes.

17
00:01:13,970 --> 00:01:16,560
That means before we are creating a table.

18
00:01:16,580 --> 00:01:23,090
It is good, good practice to designing our table and table attributes before creating a table.

19
00:01:23,120 --> 00:01:28,300
For that purpose, I have created this notepad design documentation.

20
00:01:28,310 --> 00:01:34,670
You can see that we are going to create an order table and these are the attributes that means ID status

21
00:01:34,670 --> 00:01:36,430
details and order date.

22
00:01:36,440 --> 00:01:41,180
So I put an ID as a partition key and status as a sort.

23
00:01:41,450 --> 00:01:47,780
I will explain later, but that means we will design our table and attributes that is ready for the

24
00:01:47,780 --> 00:01:50,040
creating table on a management console.

25
00:01:50,060 --> 00:01:57,110
So please click the create table button and we will start creating our dining table.

26
00:01:57,380 --> 00:02:02,630
So after I come to create Table Page, you can see the table details in here.

27
00:02:02,630 --> 00:02:06,110
So we will configure our table with details.

28
00:02:06,290 --> 00:02:13,850
So we see the table, the taste box and dynamic DB is seamless database that require only a table name

29
00:02:13,850 --> 00:02:16,550
and the primary key when you create a table.

30
00:02:16,550 --> 00:02:22,910
So we don't need to and we don't have to specify attributes when designing our table.

31
00:02:22,940 --> 00:02:31,070
We can add the attributes when inserting table items into dynamic DB because dynamic DB is no skill

32
00:02:31,070 --> 00:02:32,540
and schemas database.

33
00:02:32,540 --> 00:02:40,220
So the first parameter is table name that we have already create our design and copy table name.

34
00:02:40,220 --> 00:02:43,310
In here we are creating an order table.

35
00:02:43,310 --> 00:02:49,130
So the second configuration is one of the important configuration, which is the partition key.

36
00:02:49,130 --> 00:02:52,100
The partition key is a part of the table's primary key.

37
00:02:52,100 --> 00:02:59,690
It's a hash value that is used to retrieve items from our table and allocate data across for scalability

38
00:02:59,690 --> 00:03:00,920
and availability.

39
00:03:00,980 --> 00:03:07,380
So we have set the partition key as a ID and I'm going to set the string.

40
00:03:07,430 --> 00:03:13,880
We can see that we have three options eating number and binary and most, if you will, use string data

41
00:03:13,880 --> 00:03:14,600
types.

42
00:03:14,600 --> 00:03:20,000
And so parsing key is so important configuration because we can change this later.

43
00:03:20,030 --> 00:03:28,160
This should only set when creating a table is the same way we have a sort k sort k also can change after

44
00:03:28,160 --> 00:03:29,180
created table.

45
00:03:29,210 --> 00:03:32,150
We can add sort k after created the table.

46
00:03:32,150 --> 00:03:37,910
So if you come to sort key, we can use a sort key as a second part of our tables.

47
00:03:37,910 --> 00:03:44,690
Primary key, the sort key allows you to sort or search among all items sharing the same partition.

48
00:03:44,690 --> 00:03:51,230
K Again, we can select the string volume in here and at this point of time would be table.

49
00:03:51,230 --> 00:03:58,310
Then we should make an important decision because these keys cannot be changed after table is created.

50
00:03:58,310 --> 00:04:02,270
So since the third key sort k is optional.

51
00:04:02,300 --> 00:04:08,150
How we can decide that if we need to put sort K or not in our dynamic db table.

52
00:04:08,150 --> 00:04:11,660
So we should think about our items into the table.

53
00:04:11,660 --> 00:04:14,240
Let me open our design window.

54
00:04:14,840 --> 00:04:22,580
So let's think now if all the table will have one more item with the same order ID, we can think that

55
00:04:22,730 --> 00:04:26,210
we can put sort key like status in order to run queries.

56
00:04:26,210 --> 00:04:28,100
So let me explain better.

57
00:04:28,250 --> 00:04:29,900
So think about that.

58
00:04:29,900 --> 00:04:33,530
We are loading the table items in here.

59
00:04:33,560 --> 00:04:36,410
I'm going to add item into table.

60
00:04:36,560 --> 00:04:40,460
Let me see that order ID equal one.

61
00:04:41,810 --> 00:04:45,500
And statues equal penny.

62
00:04:47,520 --> 00:04:50,730
So again, order ID a cool one.

63
00:04:50,730 --> 00:04:58,680
So that means ID is a partisan k, but we have one more record, one more item into our dynamic DB table

64
00:04:58,680 --> 00:05:03,840
with the same same parts in K and status could be completed.

65
00:05:04,440 --> 00:05:11,010
So if you have this kind of use case, that means same parts in K for two items.

66
00:05:11,070 --> 00:05:14,460
If this is the case, yes, it is good to use sort k.

67
00:05:14,460 --> 00:05:14,970
But.

68
00:05:14,970 --> 00:05:16,500
But it is not true.

69
00:05:16,530 --> 00:05:20,070
That means your parts in case should be always unique.

70
00:05:20,070 --> 00:05:24,510
So you don't need to put any sort k into your application.

71
00:05:24,720 --> 00:05:30,780
If a record of our order ID is unique for all items, that means that we don't need to use sort K in

72
00:05:30,780 --> 00:05:31,560
our table.

73
00:05:31,710 --> 00:05:35,340
So in our case now it is good to sort k.

74
00:05:35,340 --> 00:05:42,300
So let me create a sort key also because I would like to show you both scan and create operations on

75
00:05:42,300 --> 00:05:43,050
this table.

76
00:05:43,050 --> 00:05:47,160
So I'm going to add a sort K which is the status.

77
00:05:47,430 --> 00:05:55,080
And after that we can scroll down and we can see there are two settings types and there is a table settings.

78
00:05:55,080 --> 00:05:58,560
One is the default settings and another is customized settings.

79
00:05:58,560 --> 00:06:02,040
The default one is configured by a yes.

80
00:06:02,070 --> 00:06:08,790
You can choose the default one if you don't want to configure some advanced settings, but the customized

81
00:06:08,790 --> 00:06:12,570
one is that allow us to configure all items by ourselves.

82
00:06:12,570 --> 00:06:16,650
So default setting is the fastest way to create our table.

83
00:06:16,650 --> 00:06:23,970
We can modify these settings now or after table is created and usually we can pick the default settings.

84
00:06:23,970 --> 00:06:30,390
But let's all with all configuration with selecting the customize settings, select the customize settings.

85
00:06:30,390 --> 00:06:36,750
And if you scroll down, the first configuration is table class and we can select table class to optimize

86
00:06:36,750 --> 00:06:41,490
our tables, cost base or workload requirements and data access patterns.

87
00:06:41,490 --> 00:06:48,120
I'm going to select a standard way and if you scroll down, another important configuration is read,

88
00:06:48,120 --> 00:06:49,410
write capacity settings.

89
00:06:49,410 --> 00:06:55,260
You can see in here as you remember that we have to estimate which is the on demand and provision on

90
00:06:55,260 --> 00:07:02,940
demand is basically billing by paying for the actual reads and rights of our application, we can think

91
00:07:02,940 --> 00:07:04,710
that is the pay as you go model.

92
00:07:04,710 --> 00:07:11,370
So another one is the provision we can manage and optimize our cost by allocating read write capacity

93
00:07:11,370 --> 00:07:12,240
in advance.

94
00:07:12,240 --> 00:07:16,890
So when it comes to use with server services, we should pick the on demand service.

95
00:07:16,890 --> 00:07:21,510
I'm going to select the on demand and it is good fit to our serverless applications.

96
00:07:21,690 --> 00:07:25,290
We can also scroll down and see the secondary index conditions.

97
00:07:25,290 --> 00:07:27,330
You can see the secondary index.

98
00:07:27,330 --> 00:07:31,350
We have local secondary index and global secondary index.

99
00:07:31,350 --> 00:07:37,290
Local index similar with the sort Keith is note that we can't add sort key after the table creation,

100
00:07:37,290 --> 00:07:42,120
but we can add the local index in order to provide query in the selected region.

101
00:07:42,300 --> 00:07:48,420
And we have also a global secondary index, GSI, we can add this after table creation.

102
00:07:48,420 --> 00:07:52,530
This is adding index globally and effect to cost for our table.

103
00:07:52,560 --> 00:07:57,330
This is not free, so please don't create a global secondary index for our project.

104
00:07:57,330 --> 00:08:00,600
So I'm going to leave default settings in here.

105
00:08:00,630 --> 00:08:02,820
Another configuration is encryption.

106
00:08:02,820 --> 00:08:09,150
You can see in here that I am not going to change and leave as the default one and go to scroll on at

107
00:08:09,150 --> 00:08:12,210
the bottom of the page and click the create table button.

108
00:08:13,720 --> 00:08:19,210
Often this kind of takes a couple of minutes to create the A.V. Table It's going to provision the database

109
00:08:19,210 --> 00:08:20,470
somewhere in the region.

110
00:08:20,470 --> 00:08:21,500
So check this out.

111
00:08:21,640 --> 00:08:26,920
With refreshing this table, you can see that it's sort of creating if it refresh, we can see that

112
00:08:26,920 --> 00:08:28,150
this is the active now.

113
00:08:28,450 --> 00:08:31,630
So refresh since we can see active status.

114
00:08:31,630 --> 00:08:38,470
And if you click the table and go to summary page, you can see that this is the table main page that

115
00:08:38,470 --> 00:08:44,830
we can see all the days, see general information section, see the primary K and sort K, you can see

116
00:08:44,830 --> 00:08:49,400
in here so and see all other features and configurations in this window.

117
00:08:49,450 --> 00:08:54,670
If you go to the indexes, you can see the all global secondary index and local secondary index.

118
00:08:54,670 --> 00:08:58,540
In this section we can also see the monitor like lambda function.

119
00:08:58,540 --> 00:09:02,740
We can monitor, read and write usage and we taste in this section.

120
00:09:02,740 --> 00:09:09,340
So as you can see that we have successfully create table in Amazon dynamic DB with using a measurement

121
00:09:09,340 --> 00:09:09,820
console.
