简体   繁体   中英

Is there an process to connect AWS lightsail mongoDB with mongo Compass?

I'm created lightsail instance for MEAN stack web app. So I watched the tutorial, they use rockmongo with GUI login. I created MongoDB database and user to access the database. So I can use it only using the ssh command line. So are there any process to connect the lightsail MongoDB with MongoDB compass?

I do it by following these steps:

Accessing MongoDB using Rockmongo The MEAN instance includes Rockmongo, a web-based GUI for MongoDB. However, by defauit it can only be accessed via connections from localhost or hosts with the IP address of 127.0.0.1.

Because your web browser is running on your local machine, you'll need to establish an SSH tunnel between your local machine and the Lightsail instance.

Note: Step 1 below is for Mac and/or Linux users - if you're on Windows using Putty please see the instructions on the Bitnami page. Once you've configured Putty, pick up the instructions below at step 2.

In your terminal open a second window and make sure you're in the directory with your default.pem file and create the SSH tunnel by entering the following command:

ssh -N -L 8888:127.0.0.1:8080 -i default.pem bitnami@<instance_ip>

This command instructs your system to tunnel any requests to http://127.0.0.1:8888/ port 8080 on your Lightsail instance.

Note: Be sure to substitute your Lightsail instance's IP address where it says <isntance_ip>.

Note: There is no output from this command the cursor will just appear below the command line and sit there.

In your web browser navigate to http://127.0.0.1:8888/rockmongo/

Log in using the same credentials you used to access the MongoDB CLI previously.

You should be presented w/ the Rockmongo web UI.

Credit: https://github.com/mikegcoleman/todo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM