Machine Pools & Cloud Profiles for MongoDB

ScaleGrid machine pools and Cloud Profiles are a very powerful construct that help administrators and developers organize and streamline common machine settings on the Amazon EC2 machines. Cloud Profiles provide a single mechanism to group together and handle as a single construct a number of settings like AWS keys, regions, keypairs and security groups. This frees developers and administrators from worrying about each individual setting during machine provisioning time.

When deploying a MongoDB instance on our MongoDB hosting plans, the only setting you need to remember is which machine pool this MongoDB instance will be placed into. Machine pools can be created for your own MongoDB on AWS accounts or you can use the “SYSTEM” machines pools that are owned by ScaleGrid. If you use your own AWS account, you’re responsible for the EC2 charges, data transfer and storage costs. If you use the “SYSTEM” machine pools, it’s a fully hosted option and all resources are provided by ScaleGrid.

In the rest of this post, we’ll walk through a simple scenario using machine pools. The scenario is to create two machine pools:

  • Development Machine Pool

    This machine pool is hosted in the US-West region. The MongoDB instances deployed in this machine pool are accessible to the internet. This is the pool the developers use to do most of their development and testing of the application and MongoDB.

  • Production Machine Pool

    This machine pool is hosted in the US-East region and hosts the production servers. The MongoDB instances deployed in this machine pool can only be accessed from the application frontend servers.

Here are the steps to create these two machine pools:

  1. Create a Machine Pool

    Log into the console, click on the Machine Pools tab at the top right of the console and click on the “create” button in the action bar.

  2. Enter AWS API and Secret Keys

    The first step in the Create Machine Pool wizard is to enter your API and Secret keys from your AWS account.

  3. Select a Machine Pool Region

    Next, you’re going to select the region for your machine pool. Since we want the dev machine pool to be in the US west region, select US-West-1 (N california) and click next.


  4. Choose Your Access Policy

    This is a very important selection for the security of your MongoDB instances as it controls who can access your instances. There are three possible options:

    • Internet –  This exposes your MongoDB instances to the internet.

    • Internal to your account – This exposes your MongoDB instances to all other machines in your account.

    • Security groups – You can pick the security groups in your account that have access to your MongoDB instances. For your production instances, you would only give the security group containing your frontend servers access to the MongoDB databases.

  5. Name the Machine Pool

    Since this machine pool is used for development, we name it the dev machine pool.

  6. KeyPair Creation

    The machine pool creation process automatically creates a KeyPair for this machine group. The name of the KeyPair will be in this format – “MongoDirector-< Name of the machine pool>”. Once the machine pools is created, you can access the KeyPair in the details tab of the machine pool. The KeyPair is also accessible from the details tab of each MongoDB instance deployed in the machine pool.

  7. Security Group Creation

    The machine pool creation process automatically creates an EC2 security group for each machine pool. The name of the KeyPair will be in this format – “MongoDirector-< Name of the machine pool>”. By default, the created security group has only two open ports – 22 for SSH and 27017 for the Mongo instance. If necessary, you can edit the security group directly in EC2 to open/close the ports that you need.

Once the Dev Machine Pool is created, it can be used as a target for the deployment of new instances.


Dharshan is the founder of ScaleGrid.io (formerly MongoDirector.com). He is an experienced MongoDB developer and administrator. He can be reached for further comment at @dharshanrg


0 Shares
+1
Tweet
Share
Share
Pin