title: AWS Serverless Aurora - Communications link failure with primary. No active connection found for master
body: <p>Application deployed on Amazon ECS (using Fargate) is facing issues connecting with Serverless Aurora DB.
  I can successfully connect to this serverless DB using the bastion host, EC2 instance in the same VPC with public IP and SSH Tunnel.
  DB connection works successfully for <code>provisioned</code> EngineMode but for <code>serverless</code> it throws the following error:</p>
  <pre><code>2020-11-23 10:31:09.378 ERROR [main] com.zaxxer.hikari.pool.HikariPool request-id: ; user-id:  - jdbc:mysql:aurora://db-cluster-endpoint.us-west-2.rds.amazonaws.com:3306/test_service - Exception during pool initialization. 
  java.sql.SQLNonTransientConnectionException: Communications link failure with primary. No active connection found for master. 
      at org.mariadb.jdbc.internal.failover.AbstractMastersListener.throwFailoverMessage(AbstractMastersListener.java:559)
      at org.mariadb.jdbc.internal.failover.impl.MastersSlavesListener.checkInitialConnection(MastersSlavesListener.java:350)
      ...
      at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473)
      at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:554)
      at com.zaxxer.hikari.pool.HikariPool.&lt;init&gt;(HikariPool.java:115)
  </code></pre>
  <p>DB Cluster Configuration: I've disabled the auto-pause feature and configured cluster such that 2 instances would be up all the time. I can see CPU utilization and capacity unit 2 in RDS (AWS Console).</p>
  <pre><code>Type: AWS::RDS::DBCluster
  Properties:
    BackupRetentionPeriod: !Ref DbBackupRetentionPeriod
    DBClusterParameterGroupName: !Ref DbClusterParameterGroup
    DBSubnetGroupName: !Ref DbSubnetGroup
    Engine: aurora-mysql
    EngineMode: serverless
    ScalingConfiguration:
      AutoPause: false
      MinCapacity: 2
      MaxCapacity: 32
  </code></pre>
  <p>Datasource configuration:</p>
  <pre><code>&lt;bean name=&quot;dataSource&quot; class=&quot;com.zaxxer.hikari.HikariDataSource&quot;&gt;
      &lt;property name=&quot;jdbcUrl&quot;
                value=&quot;#{'jdbc:mysql:aurora') + '//${database.host}:${database.port:3306}/${database.name}'}&quot;/&gt;
      &lt;property name=&quot;username&quot; value=&quot;${database.username}&quot;/&gt;
      &lt;property name=&quot;password&quot; value=&quot;${database.password}&quot;/&gt;
      &lt;property name=&quot;driverClassName&quot; value=&quot;org.mariadb.jdbc.Driver&quot;/&gt;
  </code></pre>
  <p><em><strong>SOLVED</strong></em>:</p>
  <p>The problem was with the access restriction for the user that a client was using to establish a DB connection.</p>