Now if you visit mongodb.com,
there is a chance you'll automatically see mongodb atlas there on the front page and then you can
just click on get started free.
If you don't see it, you can click on solutions and then there, choose mongodb Atlas
and if you are on that page, you should at least have a get started free button.
Now if you click on that button, you are required to sign up
and as you see, there is no credit card required
so you can absolutely start for free without any danger of getting charged.
So make sure you do sign up here,
I already do have an account so I'll just sign in
and once you are signed in, you should end up on a page like this
or maybe you have to create a project first,
so simply fill out the project details, give it a name and then you should end up on this clusters page
here. Now clusters simply describe a mongodb environment,
a cluster contains all your shards, all your replica sets,
it's basically what you deploy, it's your deployed mongodb server.
So here on the clusters page,
I can click build a new cluster and this is the page where you can now configure your mongodb
environment as it will be deployed for you,
now let me walk you through that page.
The things you see here might change slightly but in general, you have a global cluster configuration which
is not available for free,
you actually have to choose the M30 tier to which I'll come back once we dive into the tiers which is
a bit more expensive but there, what you can efficiently do is you can choose different parts on the
world where you want to deploy different clusters or shards you could say that then talk to each
other, which is not a trivial set up but you can do it with a couple of clicks.
The idea of course is you can also choose from a couple of templates here that your data is distributed
across the world so that your users have the shortest way to the data possible, so that if a user in Europe
requests something from your app, you can reach out and will automatically reach out to the closest
mongodb server in Europe
and if the user sits in the US, well then US mongodb distribution is used
and this happens automatically then.
So this is something you can enable but not something I will enable here. As a next step, you have to
choose the underlying cloud provider,
now you don't have to sign up with these cloud providers but mongodb,
the company does not host its own data centers, instead the mongodb solution you configure here
will be deployed in data centers of one of these free providers here.
Now I'll stick to AWS and there you can then choose the region where you want to deploy, in case you're
not using that global cluster configuration.
Now make sure to choose a region where free tier available is added, so that you can get started for
free
but of course if you are willing to pay, you can choose from all these regions and from the different
providers too. The next important thing is the cluster tier,
this defines the power you have and what you can do. Now for the free tier you have to choose
the M0 instance and you can follow along with that,
I will choose a slightly different instance because I want to configure something else which is not
available for free but which you also don't need to do as part of this course.
So you can absolutely continue for free,
I will choose the M10 instance here because that allows me to show you something else.
So I'll take the paid one and I added a credit card,
you should of course use the free one.
Now you can see how these different instances differ or how the tiers differ I should say, you get more
power basically the more you pay
and you got solutions for basically any kind of application you could build and this will only be
one server,
now I'll come back to how you can add sharding in a second.
You can also customize the available storage,
so how much data can be stored overall in gigabytes and
well you can use that slider to change it,
you can also check that to automatically expand the storage before you exceed it
and now under additional settings, you can choose the version you want to use
and if you're using the free tier, you can't choose that.
I want to show you something in the next module which requires version four and therefore I chose
the paid version, you don't have to do this on your own in the next section though you can follow along
by watching my videos, so you can go with the older version for now and not follow along,
I will need 4.0 or higher,
so I chose the paid solution and now I can switch to that version of mongodb. Wired
Tiger is the storage engine and you see only that is available
and it's also a pretty good storage engine.
You can also configure backups and there you got the choice between two types of backup,
continuous means that all your data is basically backed up all the time,
whenever you write something and so on, you've got a continuous backup history,
so it's not once every 24 hours,
basically you can always back up to almost the latest state you were in.
The alternative is a snapshot approach where you do have a 24 hour period, so you have the danger of
losing data for the last 24 hours or for the last 23 hours
if the last backup is that long ago.
So I'll go with continuous
but of course you can choose either of the two, that is also only available when you pay I guess, yeah you
can't set up a backup otherwise,
so I will go with paid
but of course if you deploy a production solution, you will probably also pay so that that should be fine.
And then you can set up sharding,
ok for sharding I need an even bigger instance, so I'll quickly switch to that, M30 so I can show it
to you for now.
You can set up sharding and then you can choose how many shards do you want
and that is how you then add even more power besides the tier you chose here.
Now I don't need sharding here so I'll go back to M10 for now.
You can also add a couple of other options like encryption at rest which is pretty self-explanatory here,
you should check the official docs in case you want to enable though so that you get everything right.
The additional options is something you can pretty much ignore,
you could say that you want to only allow queries that run against data,
you should know what you're doing here because again, creating too many indexes is not a good idea.
You can enforce an index key limit so that your index keys can't get too long and the default is that this
is turned on
and last but not least, you assign a cluster name and then with all these things configured, you can click
create cluster
and now mongodb will deploy this solution into the web, so onto a couple of servers and this will
take a couple of minutes but thereafter, you'll have a fully functional mongodb environment
running in the cloud, automatically secured, automatically configured according to best practices,
it automatically also will be a replica set here as you see,
you automatically get a free nodes replica set here,
so this is already included,
you could add sharding and all these things and you can also reconfigure it after it's running,
check the official atlas docs for all the details.
Now whilst this is being created which can take a couple of minutes as I mentioned,
you can also dive into the security tab and there, you can now secure access to your mongodb database.
Now as you see, I already got a couple of users
and you definitely should add a user here, you can add as many users as you want.
Give them a username and assign a password and I'll just auto-generate one and copy that, I'll need
it later,
you can always regenerate it if you will forget it though,
so I'll just save it.
You can then set up the privileges for this user, get generally is the user admin, should he just be
able to read and write to any database and check out the security module if you want to learn more
about that,
you can also configure more and assign detailed roles to the user if you need to
but I will turn Max into an atlas admin here and click add user.
Now I got my user added, another important thing is the IP whitelist,
now here I got a bunch of IPs in there which I required in the past.
Now one thing you should do here is you should add an IP address and in the end, what you will add
here will be the IP address of the server that is running your application or during development, your
current IP address which you can automatically fetch here.
You can also allow access from anywhere but this is generally discouraged because of course it opens
up your database to everyone,
people will still need to log in so you still got the mongodb user as a security mechanism
but it's still more secure to lock it down to your IP address or the IP address of your application,
so now I add my local IP address. You can also turn on some enterprise security features like a different
kind of authentication, that is all beyond the scope of this course though,
so let's go back to the overview and wait for this to finish and let me just quickly talk about other
things you can do in Atlas in the next lecture.