Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Windows Tipps & SecurityGetting Repeated No Caller ID Calls? Here’s What’s Really Going On(22.09.2026 um 22:31 Uhr)
Windows Tipps & SecurityHöllenmaschine: Gaming-Peripherie für gut 1.800 Euro für die HMX 6(23.09.2026 um 10:20 Uhr)
Windows Tipps & SecurityDas nächste große Ding: KI-Agenten(23.09.2026 um 10:30 Uhr)
Sichere ProgrammierungHow AI Is Making Restaurant Menus Easier to Navigate(23.09.2026 um 10:55 Uhr)
Windows Tipps & SecurityGetting Repeated No Caller ID Calls? Here’s What’s Really Going On(22.09.2026 um 22:31 Uhr)
Windows Tipps & SecurityHöllenmaschine: Gaming-Peripherie für gut 1.800 Euro für die HMX 6(23.09.2026 um 10:20 Uhr)
Windows Tipps & SecurityDas nächste große Ding: KI-Agenten(23.09.2026 um 10:30 Uhr)
Sichere ProgrammierungHow AI Is Making Restaurant Menus Easier to Navigate(23.09.2026 um 10:55 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Connecting MongoDB Compass to Amazon DocumentDB: A Step-by-Step Guide

MongoDB Compass is the go-to GUI for developers working with MongoDB. It's powerful, intuitive, and gives you all the tools you need—from schema exploration to index analysis and aggregation pipeline building. But what if your backend runs …

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

MongoDB Compass is the go-to GUI for developers working with MongoDB. It's powerful, intuitive, and gives you all the tools you need—from schema exploration to index analysis and aggregation pipeline building. But what if your backend runs on Amazon DocumentDB, the managed MongoDB-compatible database from AWS? And what if your cluster lives inside a VPC, inaccessible directly from your local machine?



In this tutorial, I’ll walk you through how to securely connect MongoDB Compass to Amazon DocumentDB using an EC2 bastion host and SSH tunneling. Let's get started.









🧰 Tools We’re Using





  • MongoDB CompassDownload here


  • Amazon DocumentDBAWS service page


  • Amazon EC2 (Amazon Linux 2023) – for the SSH jump host


  • MongoDB Shell (mongosh) – for testing the connection









🚧 Why SSH Tunneling?



Amazon DocumentDB clusters don’t expose public endpoints. They're designed to run within a Virtual Private Cloud (VPC), typically only accessible from within the same VPC or via VPC peering.



But if you need to access the cluster from your laptop (e.g., for development or analysis), the secure way is to set up an SSH tunnel via a bastion host.









🏗️ Step 1: Launch an EC2 Bastion Host




  1. Open your AWS console and launch a new EC2 instance (Amazon Linux 2023) in the same VPC as your DocumentDB cluster.

  2. Create a new key pair, e.g., dima-bastion-host-key-pair.pem, and download it.

  3. Open terminal on your machine and connect:




   ssh -i "dima-bastion-host-key-pair.pem" [email protected]












🛠️ Step 2: Install mongosh on EC2 (Optional Testing Step)



Inside your EC2 instance:



Create the MongoDB repo config:




   sudo vi /etc/yum.repos.d/mongodb-org-8.0.repo






Paste:




   [mongodb-org-8.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2023/mongodb-org/8.0/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-8.0.asc






Install mongosh:




   sudo yum install -y mongodb-mongosh






Download the Amazon DocumentDB CA cert:




   wget https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem






Connect using:




   mongosh docdb-cluster.cluster-xxxxxx.us-east-1.docdb.amazonaws.com:27017 \
--tls --tlsCAFile global-bundle.pem --retryWrites=false \
--username myadmin --password <your-password>












🔐 Step 3: Create an SSH Tunnel from Your Laptop



To access DocumentDB from your laptop, forward traffic via your EC2 instance:




ssh -i "dima-bastion-host-key-pair.pem" \
-L 27017:docdb-cluster.cluster-xxxxxx.us-east-1.docdb.amazonaws.com:27017 \
[email protected] -N






Keep this terminal window open. It acts as a tunnel from your laptop → EC2 → DocumentDB.









🧪 Step 4: Test with mongosh Locally



On your laptop (with the tunnel running), test connection:




mongosh localhost:27017 \
--tls --tlsAllowInvalidHostnames \
--tlsCAFile global-bundle.pem \
--retryWrites=false \
--username myadmin --password <your-password>






If successful, you should see:




rs0 [direct: primary] test>












🖥️ Step 5: Connect Using MongoDB Compass






Open MongoDB Compass and:



New Connection → Advanced



General:





  • Connection String Scheme: mongodb


  • Host: localhost:27017



Authentication:





  • Method: Username / Password


  • Username: myadmin


  • Password: <your-password>


  • Auth Mechanism: Default



TLS/SSL:





  • TLS/SSL Connection: ✅ On


  • Certificate Authority (.pem): Upload global-bundle.pem


  • Allow Invalid Hostnames: ✅ Checked



SSH Tunnel / Proxy:





  • Method: SSH with Identity File


  • Hostname: Public DNS of your EC2 instance


  • Port: 22


  • Username: ec2-user


  • Identity File: Your .pem file



Advanced:





  • Replica Set Name: rs0


  • Read Preference: Secondary Preferred


  • URI Options: Add retryWrites=false






✅ Click "Connect"



You should now be connected to your Amazon DocumentDB cluster inside MongoDB Compass!









🎉 Wrapping Up



By combining SSH tunneling and Compass’s advanced connection settings, you can safely explore your Amazon DocumentDB data from outside the AWS cloud. This method gives you the power of MongoDB’s native GUI tooling without compromising on AWS security best practices.









🔗 Resources





Connecting MongoDB Compass to Amazon DocumentDB: A Step-by-Step Guide



Connecting MongoDB Compass to Amazon DocumentDB: A Step-by-Step Guide

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Connecting MongoDB Compass to Amazon DocumentDB: A Step-by-Step Guide

Thematisch verwandte Begriffe: Connecting, MongoDB, Compass, Amazon · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-96258 | A vulnerability has been found in onSite internet GmbH Auktion NG Auktio…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick