1 00:00:02,160 --> 00:00:03,880 Now if you visit mongodb.com, 2 00:00:03,900 --> 00:00:08,370 there is a chance you'll automatically see mongodb atlas there on the front page and then you can 3 00:00:08,370 --> 00:00:10,410 just click on get started free. 4 00:00:10,770 --> 00:00:17,160 If you don't see it, you can click on solutions and then there, choose mongodb Atlas 5 00:00:17,160 --> 00:00:21,390 and if you are on that page, you should at least have a get started free button. 6 00:00:21,420 --> 00:00:24,860 Now if you click on that button, you are required to sign up 7 00:00:24,930 --> 00:00:27,300 and as you see, there is no credit card required 8 00:00:27,300 --> 00:00:31,690 so you can absolutely start for free without any danger of getting charged. 9 00:00:31,710 --> 00:00:33,810 So make sure you do sign up here, 10 00:00:33,990 --> 00:00:36,960 I already do have an account so I'll just sign in 11 00:00:37,350 --> 00:00:40,410 and once you are signed in, you should end up on a page like this 12 00:00:40,410 --> 00:00:42,900 or maybe you have to create a project first, 13 00:00:42,930 --> 00:00:47,850 so simply fill out the project details, give it a name and then you should end up on this clusters page 14 00:00:47,850 --> 00:00:52,280 here. Now clusters simply describe a mongodb environment, 15 00:00:52,320 --> 00:00:55,980 a cluster contains all your shards, all your replica sets, 16 00:00:56,010 --> 00:00:59,370 it's basically what you deploy, it's your deployed mongodb server. 17 00:00:59,640 --> 00:01:01,120 So here on the clusters page, 18 00:01:01,140 --> 00:01:07,140 I can click build a new cluster and this is the page where you can now configure your mongodb 19 00:01:07,140 --> 00:01:09,600 environment as it will be deployed for you, 20 00:01:09,600 --> 00:01:11,680 now let me walk you through that page. 21 00:01:11,850 --> 00:01:17,970 The things you see here might change slightly but in general, you have a global cluster configuration which 22 00:01:17,970 --> 00:01:19,710 is not available for free, 23 00:01:19,740 --> 00:01:24,390 you actually have to choose the M30 tier to which I'll come back once we dive into the tiers which is 24 00:01:24,390 --> 00:01:31,350 a bit more expensive but there, what you can efficiently do is you can choose different parts on the 25 00:01:31,350 --> 00:01:37,740 world where you want to deploy different clusters or shards you could say that then talk to each 26 00:01:37,740 --> 00:01:41,870 other, which is not a trivial set up but you can do it with a couple of clicks. 27 00:01:42,010 --> 00:01:47,550 The idea of course is you can also choose from a couple of templates here that your data is distributed 28 00:01:47,550 --> 00:01:53,940 across the world so that your users have the shortest way to the data possible, so that if a user in Europe 29 00:01:53,940 --> 00:02:00,000 requests something from your app, you can reach out and will automatically reach out to the closest 30 00:02:00,000 --> 00:02:01,620 mongodb server in Europe 31 00:02:01,620 --> 00:02:05,550 and if the user sits in the US, well then US mongodb distribution is used 32 00:02:05,550 --> 00:02:07,800 and this happens automatically then. 33 00:02:07,830 --> 00:02:13,650 So this is something you can enable but not something I will enable here. As a next step, you have to 34 00:02:13,650 --> 00:02:16,030 choose the underlying cloud provider, 35 00:02:16,050 --> 00:02:20,110 now you don't have to sign up with these cloud providers but mongodb, 36 00:02:20,130 --> 00:02:25,920 the company does not host its own data centers, instead the mongodb solution you configure here 37 00:02:26,280 --> 00:02:30,110 will be deployed in data centers of one of these free providers here. 38 00:02:30,240 --> 00:02:35,460 Now I'll stick to AWS and there you can then choose the region where you want to deploy, in case you're 39 00:02:35,460 --> 00:02:38,310 not using that global cluster configuration. 40 00:02:38,310 --> 00:02:44,940 Now make sure to choose a region where free tier available is added, so that you can get started for 41 00:02:44,940 --> 00:02:45,740 free 42 00:02:46,200 --> 00:02:49,830 but of course if you are willing to pay, you can choose from all these regions and from the different 43 00:02:49,830 --> 00:02:53,680 providers too. The next important thing is the cluster tier, 44 00:02:53,700 --> 00:02:59,300 this defines the power you have and what you can do. Now for the free tier you have to choose 45 00:02:59,590 --> 00:03:02,660 the M0 instance and you can follow along with that, 46 00:03:02,790 --> 00:03:07,740 I will choose a slightly different instance because I want to configure something else which is not 47 00:03:07,740 --> 00:03:12,050 available for free but which you also don't need to do as part of this course. 48 00:03:12,090 --> 00:03:14,340 So you can absolutely continue for free, 49 00:03:14,510 --> 00:03:21,090 I will choose the M10 instance here because that allows me to show you something else. 50 00:03:21,090 --> 00:03:24,560 So I'll take the paid one and I added a credit card, 51 00:03:24,660 --> 00:03:26,620 you should of course use the free one. 52 00:03:26,640 --> 00:03:32,280 Now you can see how these different instances differ or how the tiers differ I should say, you get more 53 00:03:32,280 --> 00:03:34,890 power basically the more you pay 54 00:03:34,890 --> 00:03:40,230 and you got solutions for basically any kind of application you could build and this will only be 55 00:03:40,230 --> 00:03:41,190 one server, 56 00:03:41,190 --> 00:03:44,850 now I'll come back to how you can add sharding in a second. 57 00:03:44,850 --> 00:03:46,750 You can also customize the available storage, 58 00:03:46,740 --> 00:03:50,030 so how much data can be stored overall in gigabytes and 59 00:03:50,070 --> 00:03:52,950 well you can use that slider to change it, 60 00:03:52,980 --> 00:03:57,180 you can also check that to automatically expand the storage before you exceed it 61 00:03:57,360 --> 00:04:01,660 and now under additional settings, you can choose the version you want to use 62 00:04:01,770 --> 00:04:05,120 and if you're using the free tier, you can't choose that. 63 00:04:05,280 --> 00:04:10,710 I want to show you something in the next module which requires version four and therefore I chose 64 00:04:10,770 --> 00:04:16,290 the paid version, you don't have to do this on your own in the next section though you can follow along 65 00:04:16,290 --> 00:04:22,680 by watching my videos, so you can go with the older version for now and not follow along, 66 00:04:22,680 --> 00:04:24,740 I will need 4.0 or higher, 67 00:04:24,750 --> 00:04:29,950 so I chose the paid solution and now I can switch to that version of mongodb. Wired 68 00:04:29,970 --> 00:04:33,600 Tiger is the storage engine and you see only that is available 69 00:04:33,660 --> 00:04:36,930 and it's also a pretty good storage engine. 70 00:04:36,930 --> 00:04:41,720 You can also configure backups and there you got the choice between two types of backup, 71 00:04:41,760 --> 00:04:46,990 continuous means that all your data is basically backed up all the time, 72 00:04:47,160 --> 00:04:50,940 whenever you write something and so on, you've got a continuous backup history, 73 00:04:50,940 --> 00:04:53,020 so it's not once every 24 hours, 74 00:04:53,110 --> 00:04:58,230 basically you can always back up to almost the latest state you were in. 75 00:04:58,230 --> 00:05:05,060 The alternative is a snapshot approach where you do have a 24 hour period, so you have the danger of 76 00:05:05,060 --> 00:05:10,150 losing data for the last 24 hours or for the last 23 hours 77 00:05:10,340 --> 00:05:13,220 if the last backup is that long ago. 78 00:05:13,490 --> 00:05:14,650 So I'll go with continuous 79 00:05:14,660 --> 00:05:23,040 but of course you can choose either of the two, that is also only available when you pay I guess, yeah you 80 00:05:23,040 --> 00:05:25,080 can't set up a backup otherwise, 81 00:05:25,110 --> 00:05:26,580 so I will go with paid 82 00:05:26,640 --> 00:05:31,140 but of course if you deploy a production solution, you will probably also pay so that that should be fine. 83 00:05:32,630 --> 00:05:34,450 And then you can set up sharding, 84 00:05:34,600 --> 00:05:40,520 ok for sharding I need an even bigger instance, so I'll quickly switch to that, M30 so I can show it 85 00:05:40,520 --> 00:05:41,560 to you for now. 86 00:05:41,720 --> 00:05:45,620 You can set up sharding and then you can choose how many shards do you want 87 00:05:45,680 --> 00:05:51,170 and that is how you then add even more power besides the tier you chose here. 88 00:05:51,170 --> 00:05:54,360 Now I don't need sharding here so I'll go back to M10 for now. 89 00:05:56,060 --> 00:06:02,020 You can also add a couple of other options like encryption at rest which is pretty self-explanatory here, 90 00:06:02,540 --> 00:06:07,580 you should check the official docs in case you want to enable though so that you get everything right. 91 00:06:07,700 --> 00:06:11,080 The additional options is something you can pretty much ignore, 92 00:06:11,150 --> 00:06:16,650 you could say that you want to only allow queries that run against data, 93 00:06:16,850 --> 00:06:21,360 you should know what you're doing here because again, creating too many indexes is not a good idea. 94 00:06:21,380 --> 00:06:27,500 You can enforce an index key limit so that your index keys can't get too long and the default is that this 95 00:06:27,500 --> 00:06:29,160 is turned on 96 00:06:29,330 --> 00:06:36,200 and last but not least, you assign a cluster name and then with all these things configured, you can click 97 00:06:36,200 --> 00:06:37,430 create cluster 98 00:06:37,820 --> 00:06:44,210 and now mongodb will deploy this solution into the web, so onto a couple of servers and this will 99 00:06:44,210 --> 00:06:49,340 take a couple of minutes but thereafter, you'll have a fully functional mongodb environment 100 00:06:49,430 --> 00:06:55,270 running in the cloud, automatically secured, automatically configured according to best practices, 101 00:06:55,430 --> 00:07:00,220 it automatically also will be a replica set here as you see, 102 00:07:00,320 --> 00:07:03,140 you automatically get a free nodes replica set here, 103 00:07:03,200 --> 00:07:04,940 so this is already included, 104 00:07:05,000 --> 00:07:09,940 you could add sharding and all these things and you can also reconfigure it after it's running, 105 00:07:09,950 --> 00:07:13,150 check the official atlas docs for all the details. 106 00:07:13,190 --> 00:07:17,000 Now whilst this is being created which can take a couple of minutes as I mentioned, 107 00:07:17,270 --> 00:07:24,280 you can also dive into the security tab and there, you can now secure access to your mongodb database. 108 00:07:24,300 --> 00:07:27,030 Now as you see, I already got a couple of users 109 00:07:27,200 --> 00:07:32,260 and you definitely should add a user here, you can add as many users as you want. 110 00:07:32,300 --> 00:07:41,270 Give them a username and assign a password and I'll just auto-generate one and copy that, I'll need 111 00:07:41,270 --> 00:07:41,940 it later, 112 00:07:42,110 --> 00:07:44,610 you can always regenerate it if you will forget it though, 113 00:07:44,720 --> 00:07:46,650 so I'll just save it. 114 00:07:46,700 --> 00:07:52,820 You can then set up the privileges for this user, get generally is the user admin, should he just be 115 00:07:52,820 --> 00:07:57,890 able to read and write to any database and check out the security module if you want to learn more 116 00:07:57,890 --> 00:07:58,690 about that, 117 00:07:58,880 --> 00:08:04,860 you can also configure more and assign detailed roles to the user if you need to 118 00:08:04,970 --> 00:08:10,950 but I will turn Max into an atlas admin here and click add user. 119 00:08:11,010 --> 00:08:15,790 Now I got my user added, another important thing is the IP whitelist, 120 00:08:15,820 --> 00:08:20,520 now here I got a bunch of IPs in there which I required in the past. 121 00:08:20,520 --> 00:08:26,670 Now one thing you should do here is you should add an IP address and in the end, what you will add 122 00:08:26,670 --> 00:08:33,240 here will be the IP address of the server that is running your application or during development, your 123 00:08:33,330 --> 00:08:36,360 current IP address which you can automatically fetch here. 124 00:08:36,440 --> 00:08:41,910 You can also allow access from anywhere but this is generally discouraged because of course it opens 125 00:08:41,910 --> 00:08:43,700 up your database to everyone, 126 00:08:43,710 --> 00:08:48,900 people will still need to log in so you still got the mongodb user as a security mechanism 127 00:08:48,900 --> 00:08:55,560 but it's still more secure to lock it down to your IP address or the IP address of your application, 128 00:08:55,560 --> 00:09:02,400 so now I add my local IP address. You can also turn on some enterprise security features like a different 129 00:09:02,400 --> 00:09:06,760 kind of authentication, that is all beyond the scope of this course though, 130 00:09:06,930 --> 00:09:12,540 so let's go back to the overview and wait for this to finish and let me just quickly talk about other 131 00:09:12,560 --> 00:09:15,530 things you can do in Atlas in the next lecture.