code: @Override
    public boolean checkIfMaster() throws SQLException {
      proxy.lock.lock();
      try {
        Results results = new Results();
        executeQuery(this.isMasterConnection(), results,
            "select @@innodb_read_only");
        results.commandEnd();
        ResultSet queryResult = results.getResultSet();
        if (queryResult != null && queryResult.next()) {
          this.masterConnection = (0 == queryResult.getInt(1));
  
          reader.setServerThreadId(this.serverThreadId, this.masterConnection);
          writer.setServerThreadId(this.serverThreadId, this.masterConnection);
        } else {
          this.masterConnection = true;
        }
  
        this.readOnly = !this.masterConnection;
        return this.masterConnection;
  
      } catch (SQLException sqle) {
        throw new SQLException(
            "could not check the 'innodb_read_only' variable status on " + this.getHostAddress()
                + " : " + sqle.getMessage(), CONNECTION_EXCEPTION.getSqlState(), sqle);
      } finally {
        proxy.lock.unlock();
      }
    }
docs: Aurora best way to check if a node is a master : is not in read-only mode.
  
  @return indicate if master has been found