aws-solutions / instance-scheduler-on-aws

A cross-account and cross-region solution that allows customers to automatically start and stop EC2 and RDS Instances
https://aws.amazon.com/solutions/implementations/instance-scheduler-on-aws/
Apache License 2.0
541 stars 264 forks source link

Databases of cluster doesn't stop #511

Closed DevMasterSoonToBe closed 7 months ago

DevMasterSoonToBe commented 7 months ago

Describe the bug

Databases clusters that have source and replica don't stop even though it should be controlled with instance scheduler.

To Reproduce

  1. Create source and read replica rds
  2. Tag with required tag in order for instance scheduler to work
  3. Check Cloudwatch logs for an error

Expected behavior

Instance scheduler to stop instances that are source & read replica

Please complete the following information about the solution:

To get the version of the solution, you can look at the description of the created CloudFormation stack. For example, "(SO0030) instance-scheduler-on-aws v1.5.1". You can also find the version from releases

Screenshots If applicable, add screenshots to help explain your problem (please DO NOT include sensitive information).

Additional context Add any other context about the problem here.

CrypticCabub commented 7 months ago

Hi @DevMasterSoonToBe

Have you tagged the RDS cluster itself or one of the instances in the cluster? For cluster scheduling Instance Scheduler needs to use the cluster APIs and so tags must be applied to the top-level cluster and not the underlying instances

DevMasterSoonToBe commented 7 months ago

I have a primary and replica. They are both tagged with required tag for instance scheduler to work. I don't see an option to tag on the cluster level in the console. It is a mysql rds primary and replica setup. So its not actually a DB cluster, but instances(primary and replica)

CrypticCabub commented 7 months ago

Ah gotcha, thanks.

This looks to be a service limitation of RDS itself as described here: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_StopInstance.html#USER_StopInstance.Limitations

You can't stop a DB instance that has a read replica, or that is a read replica.

So unfortunately there's no way for Instance Scheduler to stop the instance