DaaS / Products / Database-Driven Auto Scaling Pipeline

Database-Driven Auto Scaling Pipeline

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.

Products involved

Scenario

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.

Integration steps

  1. Enable RDS Metric Publishing: Following rds-monitor-performance, publish metrics to CloudMonitor at a 60s interval: aliyun rds ModifyDBInstanceMonitor --DBInstanceId <instance-id> --Period 60.
  2. Create ESS Scaling Group & Rule: Per 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.
  3. Configure EventBridge Event Source: As routed by eb-configure-streaming, register the RDS metric stream: aliyun eventbridge CreateEventBus --EventBusName rds-metrics-bus.
  4. Define EventBridge Rule & Filter: Create a threshold rule matching the eb-monitor-alerts pattern:
  5. ``bash aliyun eventbridge PutRule --EventBusName rds-metrics-bus --RuleName rds-cpu-threshold \ --EventPattern '{"source":["acs.rds"],"type":["CloudMonitor:Metric"],"detail":{"metricName":"CPUUtilization","value":{">":80}}}' ``

  6. Route to ESS Target: Attach the scaling rule ARN as the EventBridge target:
  7. ``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}"}]' ``

  8. Configure Monitoring Alerts: Enable delivery failure alerts per eb-monitor-alerts: aliyun eventbridge PutRuleAlert --RuleName rds-cpu-threshold --AlertThreshold 1 --Period 300.

Architecture

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.

Prerequisites

Common pitfalls

Typical questions