mongodb-org-4.0.repo : No such file or directory al instalar el mongo shell en mi AWS Cloud9

0

I try to connect to my cluster DocumentDB on AWS from AWS C9 with this tutorial. But every time I try to connect I get connection failed after 6 attempts:

(scr_env) me:~/environment/sephora $ mongo --ssl --host xxxxxxxxxxxxx:xxxxx --sslCAFile rds-combined-ca-bundle.pem --username username --password mypassword
MongoDB shell version v3.6.3
connecting to: mongodb://xxxxxxxxxxxxx:xxxxx/
2022-03-22T23:12:38.725+0000 W NETWORK  [thread1] Failed to connect to xxx.xx.xx.xxx:xxxxx after 5000ms milliseconds, giving up.
2022-03-22T23:12:38.726+0000 E QUERY    [thread1] Error: couldn't connect to server xxxxxxxxxxxxx:xxxxx, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed

Indeed it seems to be missing the VPC configuration. So I tried to do with this documentation. But I do not know how to install the mongo shell on my AWS Cloud9. Indeed, it seems that I cannot create the repository file with the echo -e "[mongodb-org-4.0] \name=MongoDB repository baseurl=.... returns: mongodb-org-4.0.repo: No such file or directory.

Also, when I tried to install the mongo shell with sudo yum install -y mongodb-org-shell which I did not have, and which I installed, it returns repolist 0.

2 Answers
0

Hello, Can you confirm the full echo command? It should be:

echo -e "[mongodb-org-4.0] \nname=MongoDB Repository\nbaseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/4.0/x86_64/\ngpgcheck=1 \nenabled=1 \ngpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc" | sudo tee /etc/yum.repos.d/mongodb-org-4.0.repo

For connecting to Amazon DocumentDB I recommend following the getting started guide, which details the VPC and security group configuration.

AWS
Mihai A
answered 2 years ago
  • I confirm, Here is the full output:

    :~/environment/sephora $ echo -e "[mongodb-org-4.0] \nname=MongoDB Repository\nbaseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/4.0/x86_64/\ngpgcheck=1 \nenabled=1 \ngpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc" | sudo tee /etc/yum.repos.d/mongodb-org-4.0.repo
    tee: /etc/yum.repos.d/mongodb-org-4.0.repo: No such file or directory
    [mongodb-org-4.0] 
    name=MongoDB Repository
    baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/4.0/x86_64/
    gpgcheck=1 
    enabled=1 
    gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
    
0

It looks that you're missing the /etc/yum.repos.d directory. Are you on a Ubuntu 18 Cloud9 environment by any chance? If this is the case, then the steps to install the mongo client on Ubuntu are:

  1. Add the MongoDB GPG key:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
  1. Add MongoDB repository:
sudo add-apt-repository 'deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse'

  1. Refresh packages list and install mongo client and tools:
sudo apt update
sudo apt install mongodb-org-shell mongodb-org-tools
AWS
Mihai A
answered 2 years 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