When setting up your cloud infrastructure, you can check if your instances have access to the database by performing this command.

<pre lang="bash">
$ nc -zv 10.0.0.45 3306
$ nc -zv domain.com 3306
$ nc -zv endpoint.amazonaws.com 3306

If connection has succeeded, you’ll get a message like this in Linux and MacOS …

<pre lang="bash">
Connection to endpoint.amazonaws.com 3306 port [tcp/mysql] succeeded!

On Windows, you can use Telnet to test your DB connection.

<pre lang="bash">
C:\>telnet endpoint.amazonaws.com 3306

If connection has succeeded, the result is “no message.” If there’s a problem, you’ll get this ….

<pre lang="bash">
Connecting To endpoint.amazonaws.com...Could not open 
connection to the host, on port 3306: Connect failed