'Failing to connect to an Amazon Aurora MySQL from SpringBoot

I want to connect my spring boot application to AWS Aurora MySQL RDS. The problem is while there are plenty of examples of AWS MySQL RDS. I cant find an example of setting up an data connection for Aurora MySQL. I assumed that it would be the same set up as for mysql

spring:
  datasource:
    url: jdbc:mysql://credentialdb.XXXXXXXXXXXX.us-west-2.rds.amazonaws.com:3306/credentialdb
    username: admin
    password: password
    driverClassName: com.mysql.cj.jdbc.Driver
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.MySQL5Dialect
  hibernate:
    ddl-auto: update

Getting the exception

org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

credentialdb.XXXXXXXXXXXX.us-west-2.rds.amazonaws.com is the Endpoint & port is 3306 and the database is credentialdb.

Where its just guessing is this url: jdbc:mysql and this dialect: org.hibernate.dialect.MySQL5Dialect.

Its Aurora wrapped around MySQL, so my best guess is that underneath it would use MySQL driver and url prefix.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source