Upgrading Your Free MongoDB Atlas Database to Production-Ready Instances

< View all blog posts
Jay Gordon
September 12, 2017
Category: Cloud

The MongoDB Atlas free tier provides a simple interface to create and work with MongoDB databases and is great for prototyping, early development, or learning the database. But at some point, you may need or want to make use of the features not included with the M0 instance size, including:

  • Support for datasets larger than 512 MB
  • Elastic scalability
  • Region selection
  • Managed backup and restores
  • Network isolation & VPC Peering on AWS
  • The ability to review documents and metadata via the Data Explorer
  • The ability to track performance in real-time and view the hottest collections via the Real-Time Performance Panel
  • Richer, more granular monitoring metrics (with API access)
  • And more

When you’re ready to upgrade to a customized cluster for your use case, you'll find that MongoDB Atlas provides you with a frictionless process to do so.

Tutorial / Demo: Upgrading to a customized MongoDB Atlas cluster

In this blog tutorial, we'll upgrade from a free MongoDB Atlas cluster to one that we customize for our live application.

One of my favorite apps that helps users understand the simplicity of MongoDB Atlas and NodeJS is the Scotch.io node-todo app, which provides you with a full CRUD experience for the database. You can get the full details on using this Express framework single-page app by going to the Scotch.io tutorial or reviewing the github repository.

For the purposes of this tutorial, let’s say we’re running this app backed by a free M0 replica set in MongoDB Atlas. We’ve added a few documents with some tasks we need to accomplish today, but we would like to start backing up our cluster and using VPC peering with our app. Because we’re currently using a free MongoDB Atlas cluster, we won't be able to do any of these things without upgrading first.

Note that we’ll be going through this upgrade process on a Macbook, but this work can be easily done on a VM or bare metal server running Linux.

Installing this application is simple for those who have experience with NodeJS and MongoDB. For those who may be new to these technologies, check out the Getting Started with MongoDB, Node.js and Restify for any requirements (NodeJS, npm).

So let's download our repo and install the app:

bash-3.2$ git clone https://github.com/scotch-io/node-todo
Cloning into 'node-todo'...
remote: Counting objects: 452, done.
remote: Total 452 (delta 0), reused 0 (delta 0), pack-reused 452
Receiving objects: 100% (452/452), 58.45 KiB | 0 bytes/s, done.
Resolving deltas: 100% (158/158), done.

bash-3.2$ cd node-todo/
bash-3.2$ npm install

(when completed, the following output should be displayed)

npm WARN node-todo@0.0.1 No repository field.
npm WARN node-todo@0.0.1 No license field.

Our app will have some default MongoDB settings in the config/database.js file we will need to modify the default MongoDB servers:

Default:

module.exports = {
    remoteUrl : 'mongodb://node:nodeuser@mongo.onmodulus.net:27017/uwO3mypu',
    localUrl: 'mongodb://localhost/meanstacktutorials'
};

Modify this to contain our MongoDB Atlas cluster details, for example:

module.exports = {
    localUrl : 'mongodb://username:password@clustername0-shard-00-00-bywqq.mongodb.net:27017,clustername0-shard-00-01-bywqq.mongodb.net:27017,clustername0-shard-00-02-bywqq.mongodb.net:27017/node-todo?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin',
};

And then we start the app:

bash-3.2$ npm start

> node-todo@0.0.1 start /Users/jaygordon/tmp/node-todo
> node server.js

Now we can go to our browser and review the app by accessing the http://localhost:8080 or whichever IP we may be using.

Using Atlas is an easy experience, and of course that includes moving from our free to our paid tiers. Let's see how we can get the cluster from a free, multi-tenant deployment to a paid deployment with all the features that come along with it.

When we log into our Atlas account and find our free cluster, we’ll now see an “Upgrade” button in the lower right hand side of the cluster information window:

When we click on this button, we will be taken to a cluster overview window with upgrade options. Because we're sticking with AWS in this example, we won't have to worry about our connection string changing. If we had opted for another cloud provider such as Google or Azure, we would have had to modify our connection string in our application.

In our case, we’ll upgrade our M0 to an M30 cluster in the AWS us-east-1 region. We can click "Continue to Payment" to proceed.

We’ll enter our credit card information and then click "Confirm and Deploy."

The upgrade process will take a few minutes, during which there will be downtime of our solution; in the background, our cluster is being moved from a multi-tenant deployment to a single-tenant architecture in its own virtual private cloud (VPC), new nodes are being spun up across multiple availability zones for improved resiliency, data is synced, EBS volumes are being spun up, etc. We can keep track of the process by reviewing the blue bar at the top of our Atlas window:

Since the process is fully automated by MongoDB Atlas, all we have to do is wait for it to complete and verify that our application is online afterwards.

When the process completes, we will see that the information about our new cluster has been refreshed in the Atlas UI.

The app still seems to be working in our browser; let's review one of the documents from the app directly via the Data Explorer to ensure our data exists as expected. We can click on the cluster name, then select "Data Explorer." Here we'll see the admin database as well as the "node-todo" database that we used for our app.

When we click the node-todo database, we are then brought to the collection level where we can begin reviewing documents directly from the Atlas window:

Get Started

To start using the M0 free tier of MongoDB Atlas for development or learning, you can sign up here. There’s no credit card required to start and as we’ve demonstrated in this blog, you can easily upgrade to a customized cluster at any time.

comments powered by Disqus