Unable to connect to Mlab.com database from AWS EC2 instance
<p>I am trying to connect to my MongoDB instance hosted on <a href="http://mlab.com" rel="nofollow noreferrer">http://mlab.com</a> from AWS EC2 instance. </p>

<pre><code>$ mongo ds023495.mlab.com:23495/db -u username -p password
MongoDB shell version: 2.6.10
connecting to: ds023495.mlab.com:23495/db
2016-11-29T08:01:14.014+0000 Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18 } at src/mongo/shell/db.js:1287
exception: login failed
</code></pre>

<p>But if I try to do it from my local machine, it is able to connect to same database.
<br>
What's going wrong with EC2 instance?
Do I need to whitelist some protocols or ports from AWS Security Groups?</p>