0

I have 2 EC2 instances first one is a node js app server the second one is a mongo db server. I cant reach the database server from the app server or any where else.

I can ping the app server(private and public ip adress) from the mongodb server but cant ping the mongodb server(private and public ip adress) from the app server. I can ssh into both.

The mongodb server has its mongod config file with the network field as :

  network
    bind: [0.0.0.0, private_ip_of_instance]

Anyway i believe that cant be the problem. I can access my mongo DB from within the instance and query it as well. The status of the mongod service on the mongodb server is active.

The output log of the mongo db instance says

 Waiting for connections on port 27017

My nodejs environment on the app server has a config file that points to the private_ip of the mongo db server instance on port 27017 along with the database name.

The ufw firewall of the mongodb instance has the following status

22                         ALLOW       Anywhere
27017                      ALLOW       public_ip_address
27017                      ALLOW       private_ip_address
80/tcp                     ALLOW       Anywhere
22 (v6)                    ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)

So i dont believe its the mongodb server firewall that is blocking connections.

The security group of the mongodb instance is configured to allow access from anywhere on port 80. I have tried pining the public ip of the mongdb instance from my local machine but all packets are lost and i can ping the public ip of the app server and no packets lost.

Its weird cause everything was working before. App server was talking to Mongodb server and fetching data and returning till today.

2
  • Do you not have port 27017 open in the security group assigned to the MongoDB server? You only mentioned that port 80 is open for some reason. Commented Aug 14, 2017 at 17:25
  • @Mark B .... Oh My....Cant Imagine i removed it for a very silly reason....Thanks....Just added it again. Please add your answer Commented Aug 14, 2017 at 17:32

1 Answer 1

1

You need to open port 27017 in the security group assigned to the MongoDB server.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.