Menu
MongoDB on AWS
Quick Start Reference Deployment Guide

Step 3. Connect to MongoDB Nodes

Once the AWS CloudFormation template has successfully created the stack, all the MongoDB nodes will be running with the software installed in your AWS account. To connect to any of the MongoDB nodes, use SSH to connect to the bastion host instance. In the Amazon EC2 console, choose the instance, and then choose Connect.


                Connecting to a MongoDB node

Figure 7: Connecting to a MongoDB node

Once you connect to the bastion host instance by using SSH, you can connect to any of the MongoDB nodes in a similar fashion (choose the node, and then choose Connect to find the SSH command).

Important

You need the private key (.pem) file to connect to MongoDB nodes. Copy the private key (.pem) file into the bastion host instance; for example:

Copy
scp –i mykey.pem mykey.pem ec2-user@Bastion-public-ip:/home/ec2-user/mykey.pem

Note that all the MongoDB nodes are launched with an IAM role that grants them privileges to create and delete Amazon DynamoDB tables, to access Amazon Simple Storage Service (Amazon S3), to create and delete Amazon EC2 instances, and so on. You can modify the policy by using the IAM console. For details about the benefits of IAM roles, see Using IAM Roles to Delegate Permissions to Applications that Run on Amazon EC2 in the AWS documentation.