Propagating Aurora Cluster Tags to Read Replicas

Lecture de 2 minute(s)
Niveau du contenu : Intermédiaire
0

Amazon Aurora does not currently extend the Aurora cluster's tags to the Read-Replicas dynamically created by the corresponding Auto Scaling Policy. Here we propose a possible solution sample available at aws-sample.

Amazon Aurora Database Cluster and Read Replicas via Auto Scaling Policy

Amazon Aurora database cluster with replication is made by one primary DB instance that handles all write operations and data modifications, and up to 15 read-only Aurora Replicas can be added to offload read workloads from the primary instance. These replicas connect to the same storage volume as the primary instance but support only read operations.

Amazon Aurora Read Replicas are automatically provisioned and managed by AWS, and they can be added to an Aurora DB cluster though the AWS Management Console, AWS CLI, or RDS API or via Amazon Aurora Auto Scaling.

Amazon Aurora Auto Scaling allows to automatically adjust the number of Aurora Read Replicas in an Aurora DB cluster by continuously monitoring performance metrics of the Aurora Replicas, such as average CPU utilization or average active connections: Aurora Auto Scaling will follow the Auto Scaling policy to automatically add or remove Replicas to keep the metrics closest to the target.

It is important to note that Aurora Serverless v1 DB clusters do not support creating Aurora Replicas as they have a single instance that automatically scales up and down. However, Aurora Serverless v2 DB clusters allow adding reader instances for read workloads.

Automatic Autoscaling Read Replicas Tagging from Database Cluster

Currently, Amazon Aurora Auto Scaling does not extend the Aurora Cluster's tags to the Read Replicas dynamically created. However, users might need to extend such tags to all the Read Replicas for several reasons, such as cost allocation purposes.

We propose one solution which captures the CreateDBInstance event generated when a database instance is created by an EventBridge rule. The rule triggers an AWS Lambda function which performs some checks before retrieving the Amazon Aurora Cluster tags that are appended to the Auto Scaling Read Replica instance(s). This solution is available as an aws-sample. Please note that this is a sample and you have to review and you can modify according to your needs.

Enter image description here