title: SpringBoot app running on AWS-EC2 unable to connect to MySQL AWS-RDS database
body: <p>I am having problems running an app I have developed in an EC2 instance. When I execute the .jar (java -jar app.jar), the SpringBoot app starts but it fails when trying to connect to my MySQL RDS database. The thing is when I run the app locally on my machine, It has no issues with the DB connection.</p>
  
  <p>I have opened the port where the app is running (8090) and MySql port as well (3306) for inbound and outbound traffic:</p>
  
  <p><a href="https://i.stack.imgur.com/nJ7Bt.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nJ7Bt.jpg" alt="enter image description here"></a></p>
  
  <p>This is the error I get:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>2016-09-23 17:46:38.132  INFO 10161 --- [main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 8090
  2016-09-23 17:46:38.604  INFO 10161 --- [main] o.apache.catalina.core.StandardService   : Starting service Tomcat
  2016-09-23 17:46:38.605  INFO 10161 --- [main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/7.0.54
  2016-09-23 17:46:38.724  INFO 10161 --- [ost startStop 1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
  2016-09-23 17:46:38.725  INFO 10161 --- [ost startStop 1] o.s.web.context.ContextLoader: Root WebApplicationContext: initialization completed in 5028 ms
  2016-09-23 17:48:48.476 ERROR 10161 --- [ost startStop 1] o.a.tomcat.jdbc.pool.ConnectionPool: Unable to create initial connections of pool.
  
  com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  
  The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.</code></pre>
  </div>
  </div>
  </p>
  
  <p>Any ideas how can i solve this problem?</p>
  
  <p>Thank you very much  for your help</p>
  
  <p>Regards</p>
  
  <p>Andres</p>