title: mongodb connection refused on new machine
body: <p>I have mongodb installed on ec2 instance, I am upgrading the system so I created an image of the instance and then launched a new instance from it. Everything seems to be working properly however I am not able to connect with mongodb, it returns connection refused error. mongodb version is 3.6.5. I have restarted the mongodb, allowed location in mongo.conf, deleted lock file already but nothing works. Can someone help me with this. I am not sure what details I should provide here but following is the response I am getting with command mentioned</p>
  <p>command : <code>mongo --host (IP) --port 27017 -u 'DBUSER' -p 'DBPASS' --authenticationDatabase 'admin'</code></p>
  <p>Response</p>
  <pre><code>MongoDB shell version v3.6.5
  connecting to: mongodb://(IP):27017/
  2021-12-21T11:45:03.486+0000 W NETWORK  [thread1] Failed to connect to (IP):27017, in(checking socket for error after poll), reason: Connection refused
  2021-12-21T11:45:03.498+0000 E QUERY    [thread1] Error: couldn't connect to server (IP):27017, connection attempt failed :
  connect@src/mongo/shell/mongo.js:251:13
  @(connect):1:6
  exception: connect failed
  </code></pre>