Configure automatic snapshots and disk backup policies for ECS instances within an Auto Scaling group while protecting mission-critical instances from termination, then route all backup completion and failure events via EventBridge to external monitoring systems or OSS for audit and alerting.
Use this workflow when deploying stateful or compliance-bound workloads in an Auto Scaling group that require guaranteed disk backups and strict termination controls. It ensures mission-critical instances are shielded from scale-in events while automatically routing snapshot success/failure telemetry to external monitoring systems or Alibaba Cloud OSS for audit trails and real-time alerting.
ProtectedFromScaleIn to shield specific ECS instances from automatic termination.``bash aliyun ess SetInstanceProtection --ScalingGroupId sg-xxx --InstanceIds.1 i-xxx --ProtectedFromScaleIn true ``
``bash aliyun ecs CreateAutoSnapshotPolicy --Name "asg-disk-backup" --TimePoints "02:00" --RetentionDays 30 --RepeatWeekdays "1,2,3,4,5,6,7" ``
``bash aliyun ecs ApplyAutoSnapshotPolicy --AutoSnapshotPolicyId sp-xxx --DiskIds.1 d-xxx ``
ecs:Snapshot:CreateSnapshotCompleted and ecs:Snapshot:CreateSnapshotFailed events.``json { "source": ["acs.ecs"], "detail-type": ["ECS Snapshot Status Change"], "detail": { "status": ["completed", "failed"] } } ``
CreateConnection with Bearer Token authentication for external HTTP APIs, or specify an OSS bucket ARN for direct archival. Set retry policies and dead-letter queues for failed deliveries.CreateSnapshot, then verify payload delivery in your OSS bucket or monitoring endpoint. Check EventBridge delivery metrics for latency and error rates.ESS manages instance lifecycle and enforces ProtectedFromScaleIn states to prevent accidental termination of critical nodes. ECS executes disk-level backup operations based on the attached auto-snapshot policy. Upon completion or failure, ECS publishes telemetry to the default EventBridge event bus. EventBridge evaluates the custom rule, authenticates via IAM/Connection, and reliably delivers the structured payload to the configured OSS bucket or external HTTP API for downstream alerting and compliance auditing.
AliyunESSFullAccess, AliyunECSFullAccess, and AliyunEventBridgeFullAccessoss:PutObject or eb:InvokeApiDestination permissions.source or detail-type values causes silent event drops; always validate against the official ECS event schema before deployment.Q: How do I configure automatic snapshots and disk backups for instances in an Auto Scaling group? A: You can configure automatic snapshots and disk backup policies for ECS instances within an Auto Scaling group using integrated data protection and recovery features. This setup ensures consistent backup coverage for your scaling environment.
Q: How can I prevent mission-critical instances from being terminated while ensuring their disks are backed up? A: Mission-critical instances are protected from termination by combining Auto Scaling group management with ECS data protection controls. This configuration safeguards essential instances while maintaining automated disk backup policies.
Q: How do I monitor backup status and route completion or failure events to OSS for alerting? A: All backup completion and failure events are routed to OSS or external monitoring systems by leveraging EventBridge delivery destinations. This integration enables centralized audit logging and automated alerting for your operations.