Step 2: Launch an Amazon EC2 Instance - Amazon DocumentDB

Step 2: Launch an Amazon EC2 Instance

Your Amazon DocumentDB cluster should be running in your default virtual private cloud (VPC). To interact with your Amazon DocumentDB cluster, you must launch an Amazon Elastic Compute Cloud (Amazon EC2) instance into your default VPC, in the same AWS Region where you created your Amazon DocumentDB cluster.

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. Choose Launch instance, and do the following:

    Step 1: Choose an Amazon Machine Image (AMI)

    At the top of the list of AMIs, go to Amazon Linux AMI and choose Select.

    Step 2: Choose an Instance Type

    1. At the top of the list of instance types, choose t2.micro.

    2. Choose Next: Configure instance details.

    Step 3: Configure Instance Details

    1. Go to Network and choose your default VPC.

    2. Choose Next: Add Storage.

    Step 4: Add Storage

    Skip this step by choosing Next: Add tags.

    Step 5: Add Tags

    Skip this step by choosing Next: Configure security group.

    Step 6: Configure Security Group

    1. Choose Select an existing security group.

    2. In the list of security groups, choose default. This is the default security group for your VPC. By default, the security group accepts inbound SSH connections on TPC port 22. If this is not the case for your VPC, you can add this rule. For more information, see What Is Amazon VPC? in the Amazon VPC User Guide.

    3. Choose Next: Review and launch.

    Step 7: Review and Launch

    1. Review all your settings. If any settings need to be changed, go back and change them before continuing.

    2. Choose Launch.

  3. In the Select an existing key pair or create a new key pair window, do one of the following:

    • If you don't have an Amazon EC2 key pair, choose Create a new key pair and follow the instructions. You are asked to download a private key file (.pem file). You need this file later when you log in to your Amazon EC2 instance.

    • If you already have an Amazon EC2 key pair, go to Select a key pair and choose your key pair from the list. You must already have the private key file (.pem file) available to log in to your Amazon EC2 instance.

  4. After you configure your key pair, choose Launch instances.

    In the console navigation pane, choose EC2 Dashboard, and then choose the instance that you launched. In the lower pane, on the Description tab, find the Public DNS for your instance, for example: ec2-11-22-33-44.us-west-2.compute.amazonaws.com.

    It takes a few minutes for your Amazon EC2 instance to become available.

  5. Use the ssh operation to log in to your Amazon EC2 instance; for example:

    chmod 400 my-keypair.pem ssh -i my-keypair.pem ec2-user@public-dns-name

    You must specify your private key file (.pem file) and the public DNS name of your EC2 instance.

    The login ID is ec2-user. No password is required.

    For more information, see Connecting to Your Linux Instance Using SSH in the Amazon EC2 User Guide for Linux Instances.

Proceed to Step 3: Access and Use Your Amazon DocumentDB Cluster Using the mongo Shell.