How to use Robomongo to connect to MongoDB server running in a Docker container inside AWS EC2
Recently I've meet the awesome Rocket.Chat and for internal reasons I need to access its database using Robomongo, a cross-plataform MongoDB client. The problem is that Rocket.Chat was running in a Docker container, it's MongoDB database was running in another Docker container, all running inside an Amazon Web Service (AWS) EC2 instance.
I thought that would be very hard to connect to my MongoDB database using Robomongo, but it was actually quite easy. In the following steps you'll discover how to use Robomongo to connect to a MongoDB database running in a Docker container inside an AWS EC2 instance.
1º Step) Discover your EC2 instance public IP and make sure you can access it through SSH. You can find your instance public IP from your EC2 Management Console:
2º Step) Discover the IP from Docker container running your MongoDB server / database. In order to do that, login to your AWS EC2 instance through SSH and then run:
docker inspect --format '{{ .NetworkSettings.IPAddress }}' <YOUR_MONGODB_DOCKER_INSTANCE_NAME>If you don't know your instance name, type "docker ps" and try to figure it out. In my case the instance name was "chat_db_1", so I run:
docker inspect --format '{{ .NetworkSettings.IPAddress }}' chat_db_1And it gives me:
[ec2-user@ chat]$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' chat_db_1 172.17.0.2From here we'll call this value by "MongoDB IP".
3º Step) Now that you have the public IP from your AWS EC2 instance and also the IP from the Docker container running MongoDB, open Robomongo and create a new connection filling the "Address" field with MongoDB IP and the "Port" field with 27017 (MongoDB default port):
Now go to the "SSH" tab and fill the fields with the following:
SSH Address: public IP from your AWS EC2 instance. Port 22.
SSH User Name: "ec2-user"
SSH Auth Method: select "Private Key".
Private Key: select the .pem file you use to access your EC2 instance through SSH.
Right now you should have the following:
4º Step) Done! Now you can visualize, edit and insert new data as you want.
If you have any questions or issues following this tutorial, let me know through the comments. Leave your comment if you liked it, too!
AwesomeAWS Online Training
ResponderExcluirThis helps the readers a lot AWS Online Training Hyderabad
ResponderExcluirnice looking great aws Online Training Hyderabad
ResponderExcluirThe article was very clear and it's usefull information aws Online Training Hyderabad
ResponderExcluirkayseriescortu.com - alacam.org - xescortun.com
ResponderExcluirSMM PANEL
ResponderExcluirsmm panel
iş ilanları
İNSTAGRAM TAKİPÇİ SATIN AL
Https://www.hirdavatciburada.com/
HTTPS://WWW.BEYAZESYATEKNİKSERVİSİ.COM.TR/
Servis
tiktok jeton hilesi
A Dedicated server in Silicon Valley requires cutting-edge technologies for businesses seeking reliable & high-performance server solutions.
ResponderExcluir