Issue with connecting to AWS DocumentDB using Mongo Shell or Mongo Compass

0

Issue with connecting to AWS DocumentDB using Mongo Shell or Mongo Compass

AWS
djinn
asked 10 months ago1602 views
1 Answer
0
Accepted Answer

Connecting Amazon DocumentDB to MongoDB Shell and Compass

To connect to Amazon DocumentDB from your MongoDB shell or MongoDB Compass, you need to ensure that you have the correct connection string and that your network configurations allow for the connection. Here's a step-by-step guide to help you connect:

  1. Get the Connection String:

    • Go to the Amazon DocumentDB console.
    • Click on your cluster.
    • In the Cluster details tab, click on the Connect button.
    • Select the Connect using MongoDB Compass option.
    • Copy the provided connection string.
  2. Verify Security Group Settings:

    • Ensure that the security group associated with your EC2 instance allows incoming connections on the DocumentDB port (default is 27017).
    • Open the Amazon EC2 console.
    • Select the EC2 instance you're using.
    • In the Description tab, look for the Security groups section and click on the linked security group.
    • In the security group settings, verify that there is an inbound rule allowing traffic on port 27017.
  3. Connect from MongoDB Shell:

    • Open your MongoDB shell on your EC2 instance.
    • Paste the connection string you copied earlier and press Enter.
    • The shell should attempt to connect to your Amazon DocumentDB cluster.
  4. Connect from MongoDB Compass:

    • Open MongoDB Compass on your local machine.
    • Click on the New Connection button.
    • In the Hostname field, paste the connection string you copied earlier.
    • Adjust any other required settings (e.g., SSL).
    • Click Connect to attempt the connection.

If you're still experiencing issues, make sure to check the following:

  • Ensure that your EC2 instance has internet access and can reach the DocumentDB cluster.
  • Double-check that the security group settings allow incoming connections on port 27017.
  • Verify that the connection string is copied correctly, including any required credentials or authentication mechanisms.

If you continue to encounter problems, please provide any specific error messages or details you're receiving so that I can assist you further.

AWS
djinn
answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions