0
votes

AWS RDS aurora mysql - from console we can do "cross region read replica" and its working .

but I don't see any option to do so with - AWS CLI - Boto3

What I found is with boto3 we can do replication for cluster but not for instance .

Please suggest if am missing something as am working on lambda function to do below operation once any new aurora rds instance being created - create cross region read replica on "Oregon" region

2

2 Answers

0
votes

If you are referring to creating a Cross-Region Read Replica, then the boto3 documentation says this for the create_db_cluster command:

You can use the ReplicationSourceIdentifier parameter to create the DB cluster as a Read Replica of another DB cluster or Amazon RDS MySQL DB instance.

Commands for Aurora always refer to a cluster whereas commands for non-Aurora Amazon RDS instances refer to instance.

0
votes

This is very tricky. It seems like you should create two or above instances to associate with cluster you created. The two instances should be in different zones, then the cluster will use the first as writer, the others as read replica. The Multi-AZ field will show "2 zones" (depends on how many zones you use to create instances)

Pseudo code like:

 cluster_response = rds.create_db_instance(....)

 instance_response = rds.create_db_instance(
          DBInstanceIdentifier='name1',
          DBInstanceClass='instance_type',
          AvailabilityZone='zone1',
          Engine=aurora-mysql,
          DBClusterIdentifier=cluster_response['DBCluster']['DBClusterIdentifier'],
 )

 instance_response = rds.create_db_instance(
          DBInstanceIdentifier='name2',
          DBInstanceClass='instance_type',
          AvailabilityZone='zone2',
          Engine=aurora-mysql,
          DBClusterIdentifier=cluster_response['DBCluster']['DBClusterIdentifier'],
 )