Monitor RDS database performance metrics, stream those events through EventBridge in real-time with monitoring alerts configured, and automatically trigger ECS Auto Scaling when database load thresholds are breached — forming a closed-loop infrastructure response to demand spikes.
Use this pipeline when your application’s compute demand is directly coupled to database load, such as during batch processing or traffic surges that cause RDS CPU or IOPS spikes. Instead of relying on ECS-level metrics alone, this setup creates a closed-loop response where RDS performance thresholds automatically drive ECS instance provisioning via EventBridge.
rds-monitor-performance, publish metrics to CloudMonitor at a 60s interval: aliyun rds ModifyDBInstanceMonitor --DBInstanceId <instance-id> --Period 60.ess-configure-triggers, provision the group and define the scale-out action: aliyun ess CreateScalingGroup --ScalingGroupName db-driven-sg --MinSize 2 --MaxSize 10. Then: aliyun ess CreateScalingRule --ScalingGroupId <sg-id> --ScalingRuleName scale-out-on-db --AdjustmentType TotalCapacity --AdjustmentValue 2.eb-configure-streaming, register the RDS metric stream: aliyun eventbridge CreateEventBus --EventBusName rds-metrics-bus.eb-monitor-alerts pattern:``bash aliyun eventbridge PutRule --EventBusName rds-metrics-bus --RuleName rds-cpu-threshold \ --EventPattern '{"source":["acs.rds"],"type":["CloudMonitor:Metric"],"detail":{"metricName":"CPUUtilization","value":{">":80}}}' ``
``bash aliyun eventbridge PutTargets --EventBusName rds-metrics-bus --RuleName rds-cpu-threshold \ --Targets '[{"Id":"1","Arn":"acs:ess:<region>:<account>:scalingRule/<rule-id>","Type":"acs.ess","Parameters":"{\"adjustmentType\":\"TotalCapacity\",\"adjustmentValue\":2}"}]' ``
eb-monitor-alerts: aliyun eventbridge PutRuleAlert --RuleName rds-cpu-threshold --AlertThreshold 1 --Period 300.RDS continuously publishes performance metrics to CloudMonitor. EventBridge ingests these as structured events, applies JSONPath filters against defined thresholds, and routes matching payloads directly to the ESS scaling rule ARN. ESS executes the scale-out action, adding ECS instances to handle the increased query load. Alerts are generated if EventBridge fails to deliver or if scaling execution times out, closing the observability loop.
AliyunRDSFullAccess, AliyunEventBridgeFullAccess, and AliyunESSFullAccess RAM roles.Period: 30 in ModifyDBInstanceMonitor if supported.type or incorrect metricName casing (CPUUtilization vs cpu_utilization) silently drops events.Cooldown: 60 in CreateScalingGroup to match real-time DB load fluctuations.ess:ExecuteScalingRule on the target ARN; otherwise, targets fail with AccessDenied.