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.
27017open in the security group assigned to the MongoDB server? You only mentioned that port80is open for some reason.