Post

SourceClusterNotSupportedException in AWS RDS: Exploring the Limitations of Source Clusters

Are you leveraging the power of Amazon Web Services (AWS) Relational Database Service (RDS) for managing your databases in the cloud? If so, you may have encountered the SourceClusterNotSupportedException when working with RDS clusters. In this article, we’ll dive deep into this exception and explore its implications, limitations, and potential workarounds. Whether you’re new to AWS RDS or an experienced user, understanding SourceClusterNotSupportedException will help you make better-informed decisions when designing your database infrastructure.

What is SourceClusterNotSupportedException?

SourceClusterNotSupportedException is an exception that can occur when attempting to create a Read Replica, Cross-Region Replica, or restoring a DB Cluster snapshot in AWS RDS. This exception is thrown when the source DB instance is not part of an Aurora global database cluster or cross-region replica.

Understanding RDS Clusters and Replicas

Before we delve into SourceClusterNotSupportedException, let’s take a brief look at RDS clusters and replicas. AWS RDS offers an efficient way to manage multiple database instances together with automated backups and failover support.

RDS Clusters

RDS clusters allow you to distribute your data across multiple instances for increased availability and performance. A DB cluster consists of a primary instance and one or more Read Replicas.

Read Replicas

Read Replicas in an RDS cluster enhance scalability by providing additional read capacity. These replicas help offload read traffic from the primary instance and can be created within the same region or in a different region altogether.

Aurora Global Database Clusters

Aurora Global Database Clusters extend the capabilities of RDS clusters by enabling replication of a primary DB cluster to secondary clusters in different AWS regions. This feature provides low-latency global read access to the replicated data.

SourceClusterNotSupportedException in Action

Let’s explore different scenarios where SourceClusterNotSupportedException can occur while working with RDS clusters.

Creating a Read Replica

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
try {
    CreateDBInstanceReadReplicaRequest request = new CreateDBInstanceReadReplicaRequest()
        .withSourceDBInstanceIdentifier(primaryInstanceIdentifier)
        .withDBInstanceIdentifier(readReplicaIdentifier)
        .withAvailabilityZone(primaryInstanceAvailabilityZone)
        // Additional configuration parameters
        // ...
    rdsClient.createDBInstanceReadReplica(request);
} catch (AmazonRDSException ex) {
    if (ex.getErrorCode().equals("SourceClusterNotSupportedException")) {
        // Handle SourceClusterNotSupportedException
    } else {
        // Handle other exceptions
    }
} 

When creating a Read Replica, if the source DB instance is not within an Aurora global database cluster or cross-region replica, the SourceClusterNotSupportedException will be thrown.

Creating a Cross-Region Replica

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
try {
    CreateDBInstanceReadReplicaRequest request = new CreateDBInstanceReadReplicaRequest()
        .withSourceDBInstanceIdentifier(primaryInstanceIdentifier)
        .withDBInstanceIdentifier(crossRegionReplicaIdentifier)
        .withAvailabilityZone(secondaryRegionAvailabilityZone)
        .withSourceRegion(primaryInstanceRegion)
        // Additional configuration parameters
        // ...
    rdsClient.createDBInstanceReadReplica(request);
} catch (AmazonRDSException ex) {
    if (ex.getErrorCode().equals("SourceClusterNotSupportedException")) {
        // Handle SourceClusterNotSupportedException
    } else {
        // Handle other exceptions
    }
}

Similarly, when creating a Cross-Region Replica, if the source DB instance is not part of an Aurora global database cluster or cross-region replica, the SourceClusterNotSupportedException will be thrown.

Restoring a DB Cluster Snapshot

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
try {
    RestoreDBClusterFromSnapshotRequest request = new RestoreDBClusterFromSnapshotRequest()
        .withDBClusterIdentifier(restoredDBClusterIdentifier)
        .withEngine(engine)
        .withSnapshotIdentifier(snapshotIdentifier)
        .withAvailabilityZones(availabilityZones)
        // Additional configuration parameters
        // ...
    rdsClient.restoreDBClusterFromSnapshot(request);
} catch (AmazonRDSException ex) {
    if (ex.getErrorCode().equals("SourceClusterNotSupportedException")) {
        // Handle SourceClusterNotSupportedException
    } else {
        // Handle other exceptions
    }
}

While restoring a DB cluster from a snapshot, if the source DB cluster is not within an Aurora global database cluster or cross-region replica, the SourceClusterNotSupportedException will be raised.

Workarounds and Best Practices

Although SourceClusterNotSupportedException indicates a limitation in certain operations, there are several workarounds and best practices to consider.

Upgrade Your DB Instance

If the source DB instance does not belong to Aurora or is not a part of an Aurora global database cluster or cross-region replica, consider upgrading your DB instance. By migrating to Aurora, you can benefit from improved performance, scalability, and global replication capabilities.

Cross-Region Replication

Create a cross-region replica of your source DB instance within an Aurora global database cluster. This approach enables you to leverage the power of global replication, providing read access to data in different regions.

Use the Latest AWS SDK

Ensure you are using the latest version of the AWS SDK for Java to stay up-to-date with the most recent enhancements, bug fixes, and feature additions. Sometimes, updating your SDK can resolve issues related to SourceClusterNotSupportedException.

Conclusion

The SourceClusterNotSupportedException in AWS RDS can be encountered when working with RDS clusters, Read Replicas, Cross-Region Replicas, or restoring DB Cluster snapshots. By understanding this exception, its causes, and potential workarounds, you can make informed decisions while designing your database infrastructure on AWS RDS.

If you find yourself facing this exception, consider upgrading your DB instance to Aurora, creating cross-region replicas, or ensuring you’re using the latest version of the AWS SDK. By implementing the best practices and workarounds discussed in this article, you can overcome the limitations of SourceClusterNotSupportedException and unlock the full potential of AWS RDS.

References:

This post is licensed under CC BY 4.0 by the author.