1 00:00:00,700 --> 00:00:04,180 So let's have a first look at DynamoDB. 2 00:00:04,180 --> 00:00:07,040 And so DynamoDB allows us to create table. 3 00:00:07,040 --> 00:00:08,570 As you can see, I just click on create table 4 00:00:08,570 --> 00:00:09,530 and there's no such thing as 5 00:00:09,530 --> 00:00:10,970 creating a database. So right away, 6 00:00:10,970 --> 00:00:11,981 we have to create a table, 7 00:00:11,981 --> 00:00:14,230 which makes it a serverless database. 8 00:00:14,230 --> 00:00:17,050 So the table is going to be DemoTable. 9 00:00:17,050 --> 00:00:18,900 And here we have to choose what's called a partition key 10 00:00:18,900 --> 00:00:20,170 and optionally a sort key. 11 00:00:20,170 --> 00:00:21,790 And the combination of these two columns 12 00:00:21,790 --> 00:00:23,870 is going to make your primary key. 13 00:00:23,870 --> 00:00:26,950 So to make it very simple, I would just have user ID 14 00:00:26,950 --> 00:00:30,273 as my partition key, and I will not specify a sort key. 15 00:00:31,270 --> 00:00:32,990 Now for the settings. This is where it gets important 16 00:00:32,990 --> 00:00:34,900 from an exam perspective. So we're going to customize 17 00:00:34,900 --> 00:00:37,990 the settings to have a look at all the options we have. 18 00:00:37,990 --> 00:00:39,620 So, for read and write capacity settings, 19 00:00:39,620 --> 00:00:40,810 we have two options. 20 00:00:40,810 --> 00:00:43,780 We can either go on-demand or provisions. 21 00:00:43,780 --> 00:00:45,170 So on demand is very simple. 22 00:00:45,170 --> 00:00:46,999 We're going to pay for the actual reads and writes 23 00:00:46,999 --> 00:00:48,770 that your application will perform. 24 00:00:48,770 --> 00:00:51,020 And again, I said, this is great when your application has 25 00:00:51,020 --> 00:00:53,460 unpredictable workloads, because on-demand 26 00:00:53,460 --> 00:00:54,980 is two to three times more 27 00:00:54,980 --> 00:00:56,830 expensive than provision capacity. 28 00:00:56,830 --> 00:00:58,130 So use at your own risk obviously, 29 00:00:58,130 --> 00:01:01,160 but this can be a great case and a great fit for many 30 00:01:01,160 --> 00:01:02,120 kinds of scenarios. 31 00:01:02,120 --> 00:01:03,980 And this is what the exam will test you on. 32 00:01:03,980 --> 00:01:05,880 Now, provisioned is when you need to 33 00:01:05,880 --> 00:01:08,160 manage and optimize your cost by allocating 34 00:01:08,160 --> 00:01:09,930 read and write capacity in advance. 35 00:01:09,930 --> 00:01:11,970 So we have two options. We have read capacity, 36 00:01:11,970 --> 00:01:14,050 and write capacity. And so for these, 37 00:01:14,050 --> 00:01:15,740 we have either auto scaling, on and off. 38 00:01:15,740 --> 00:01:18,860 So auto-scaling applies to read and write capacity. 39 00:01:18,860 --> 00:01:20,010 So if we specified off, 40 00:01:20,010 --> 00:01:21,840 then we've provisioned capacity unit. 41 00:01:21,840 --> 00:01:22,990 So we can set, for example, 42 00:01:22,990 --> 00:01:24,734 I want to provision 10 capacity units, 43 00:01:24,734 --> 00:01:26,880 and for right capacity you can say, 44 00:01:26,880 --> 00:01:28,890 I want to provision five right capacity units. Okay. 45 00:01:28,890 --> 00:01:30,210 So that's one way of doing it. 46 00:01:30,210 --> 00:01:31,910 Or if we don't know ahead of time, 47 00:01:31,910 --> 00:01:33,740 what we'll need in terms of capacity, 48 00:01:33,740 --> 00:01:36,610 we can say, hey, min is max. Min is one. 49 00:01:36,610 --> 00:01:39,950 Max is 100 and I want a target utilization of 70%. 50 00:01:39,950 --> 00:01:42,890 And automatically auto-scaling activities will take place to 51 00:01:42,890 --> 00:01:44,840 manage your read capacity, 52 00:01:44,840 --> 00:01:48,410 to match about the 70% of the target utilization, 53 00:01:48,410 --> 00:01:51,670 which is true for read capacity and for write capacity. 54 00:01:51,670 --> 00:01:53,450 So I'm going to turn it off right now and I'll just set it 55 00:01:53,450 --> 00:01:56,380 to one and one, but it shows you these two very, 56 00:01:56,380 --> 00:01:58,840 very important options you need to know. 57 00:01:58,840 --> 00:02:01,300 Next we have indexes. And indexes I will discuss them 58 00:02:01,300 --> 00:02:04,780 in the next lecture, so let's skip them for now. 59 00:02:04,780 --> 00:02:07,740 And by the way, if you want to know how to find out 60 00:02:07,740 --> 00:02:09,889 which read and write capacity is right for you, 61 00:02:09,889 --> 00:02:11,140 there's a capacity calculator. 62 00:02:11,140 --> 00:02:12,270 Now this is a bit more complex. 63 00:02:12,270 --> 00:02:14,320 This is more relevant for the developer exam. 64 00:02:14,320 --> 00:02:16,170 So I'm not going to go over it. 65 00:02:16,170 --> 00:02:17,290 Okay. 66 00:02:17,290 --> 00:02:18,750 So we're going to scroll down. 67 00:02:18,750 --> 00:02:23,200 So as you can see, because we have one RCU and one WCU, 68 00:02:23,200 --> 00:02:25,760 we have an estimated cost of 71 cents 69 00:02:25,760 --> 00:02:27,100 per month for this table. 70 00:02:27,100 --> 00:02:28,910 So this gives you information around the 71 00:02:28,910 --> 00:02:30,490 pricing of DynamoDB. 72 00:02:30,490 --> 00:02:33,660 Okay, now we will enable encryption at rest, 73 00:02:33,660 --> 00:02:36,443 and then I will click on create table. 74 00:02:38,160 --> 00:02:41,250 So now that my table is created, I can click on it. 75 00:02:41,250 --> 00:02:42,730 And then on the right hand side, 76 00:02:42,730 --> 00:02:44,600 I can have a look at view items. 77 00:02:44,600 --> 00:02:46,120 And this is just to show you how we can 78 00:02:46,120 --> 00:02:48,640 insert items into our DynamoDB table. 79 00:02:48,640 --> 00:02:50,470 So as we can see, you can create an item. 80 00:02:50,470 --> 00:02:52,860 And when you specify a user ID, for example, 81 00:02:52,860 --> 00:02:54,840 stephane under score 1 2 3, 82 00:02:54,840 --> 00:02:57,750 and then we can start adding attributes into this table. 83 00:02:57,750 --> 00:03:01,380 So we can say, name is Stephane Maarek. 84 00:03:01,380 --> 00:03:04,843 And then we can have an example around another one, 85 00:03:04,843 --> 00:03:07,513 for example, favorite movie, 86 00:03:09,180 --> 00:03:13,453 and you can say Memento, and then it may be a number. 87 00:03:14,540 --> 00:03:15,650 Favorite number... 88 00:03:17,280 --> 00:03:18,113 42. 89 00:03:18,113 --> 00:03:20,130 Okay. And we're going to create this item. 90 00:03:21,690 --> 00:03:23,000 And as you can see, now, the item has been 91 00:03:23,000 --> 00:03:24,470 inserted into my table. 92 00:03:24,470 --> 00:03:25,880 So it's quite easy to reason about, 93 00:03:25,880 --> 00:03:27,820 and we can create another item, obviously. 94 00:03:27,820 --> 00:03:31,010 We can say Alice 4 5 6, 95 00:03:31,010 --> 00:03:33,160 and again, we can set the name 96 00:03:33,160 --> 00:03:36,830 of Alice to be Alice Doe. 97 00:03:36,830 --> 00:03:38,440 And then we can just say 98 00:03:40,440 --> 00:03:41,710 favorite... 99 00:03:41,710 --> 00:03:45,150 movie and then Pocahontas. 100 00:03:45,150 --> 00:03:46,120 Okay, great. 101 00:03:46,120 --> 00:03:49,300 So I will create this item and maybe we can add also a 102 00:03:49,300 --> 00:03:51,860 number called age in here. 103 00:03:51,860 --> 00:03:53,419 I will say... 104 00:03:53,419 --> 00:03:54,890 23. 105 00:03:54,890 --> 00:03:56,340 Okay. Let's create this item. 106 00:03:58,190 --> 00:03:59,730 So as you can see, in this example, 107 00:03:59,730 --> 00:04:03,120 I specify different attributes for Alice, then Stephane. 108 00:04:03,120 --> 00:04:04,780 And the idea is that in DynamoDB, 109 00:04:04,780 --> 00:04:06,410 you don't need to have all the 110 00:04:06,410 --> 00:04:07,960 attributes filled out for all the items. 111 00:04:07,960 --> 00:04:10,390 Actually, every item can have different attributes. 112 00:04:10,390 --> 00:04:13,340 So this show you the whole power of DynamoDB table, 113 00:04:13,340 --> 00:04:17,630 and no SQL type of technology versus SQL type of technology. 114 00:04:17,630 --> 00:04:18,463 So it's very simple. 115 00:04:18,463 --> 00:04:20,807 Now we have Alice and Stephane in our table, 116 00:04:20,807 --> 00:04:22,900 and I'm not going to go too deep into DynamoDB. 117 00:04:22,900 --> 00:04:25,160 As you can see, there are a lot of options. 118 00:04:25,160 --> 00:04:26,900 So if we go back into our table, 119 00:04:26,900 --> 00:04:30,680 there are a lot of options in here available to us. 120 00:04:30,680 --> 00:04:31,810 But in the next lecture, 121 00:04:31,810 --> 00:04:34,460 what I will do is I will describe what are some of these 122 00:04:34,460 --> 00:04:36,860 options that can be important for the exam are. 123 00:04:36,860 --> 00:04:39,290 And what you need to see just in this lecture was how to set 124 00:04:39,290 --> 00:04:41,680 the read and write capacity units or the on-demand mode, 125 00:04:41,680 --> 00:04:45,040 as well as inserting some data into the DynamoDB table. 126 00:04:45,040 --> 00:04:46,010 So I hope you liked it, 127 00:04:46,010 --> 00:04:48,450 and I will see you in the next lecture.