本文介绍弹性伸缩通过操作审计、云监控和配置审计接入,作为事件源发布到事件总线EventBridge的事件类型。

事件类型

弹性伸缩支持发布到事件总线EventBridge的事件类型如下所示。

事件类型type参数值
缩容伸缩活动失败ess:ScalingActivity:ScaleInError
缩容伸缩活动部分成功ess:ScalingActivity:ScaleInPartialSuccess
缩容伸缩活动成功ess:ScalingActivity:ScaleInSuccess
扩容伸缩活动失败ess:ScalingActivity:ScaleOutError
扩容伸缩活动部分成功ess:ScalingActivity:ScaleOutPartialSuccess
扩容伸缩活动成功ess:ScalingActivity:ScaleOutSuccess
阿里云平台对资源执行的操作事件ess:ActionTrail:AliyunServiceEvent
API调用ess:ActionTrail:ApiCall
控制台的操作事件ess:ActionTrail:ConsoleOperation
弹性伸缩组缩容伸缩活动失败ess:CloudMonitor:AUTOSCALING[SCALEINERROR]
弹性伸缩组缩容伸缩活动开始ess:CloudMonitor:AUTOSCALING[SCALEINSTART]
弹性伸缩组缩容伸缩活动成功ess:CloudMonitor:AUTOSCALING[SCALEINSUCCESS]
弹性伸缩组缩容伸缩活动部分成功ess:CloudMonitor:AUTOSCALING[SCALEINWARN]
弹性伸缩组扩容伸缩活动失败ess:CloudMonitor:AUTOSCALING[SCALEOUTERROR]
弹性伸缩组扩容伸缩活动开始ess:CloudMonitor:AUTOSCALING[SCALEOUTSTART]
弹性伸缩组扩容伸缩活动成功ess:CloudMonitor:AUTOSCALING[SCALEOUTSUCCESS]
弹性伸缩组扩容伸缩活动部分成功ess:CloudMonitor:AUTOSCALING[SCALEOUTWARN]
弹性伸缩组伸缩活动执行被拒绝ess:CloudMonitor:AUTOSCALING[SCALEREJECT]
定时任务到期提醒ess:CloudMonitor:AUTOSCALING[SCHEDULETASKEXPIRING]
资源变更投递ess:Config:ConfigurationItemChangeNotification
资源评估不合规通知ess:Config:NonCompliantNotification

CloudEvents规范中定义的参数解释,请参见事件概述

缩容伸缩活动失败

缩容伸缩活动失败时,事件总线EventBridge接收到的示例事件如下所示。

{
  "id": "45ef4dewdwe1-7c35-447a-bd93-fab****",
  "source": "acs.ess",
  "specversion": "1.0",
  "subject": "arn:acs:ess:cn-hangzhou:123456789xxxxxxx:scalinggroup/asg-xxxxx",
  "time": "2020-11-19T21:04:41Z",
  "type": "ess:ScalingActivity:ScaleInError",
  "aliyunaccountid": "123456789098****",
  "aliyunpublishtime": "2020-11-19T21:04:42Z",
  "aliyuneventbusname": "default",
  "aliyunregionid": "cn-hangzhou",
  "aliyunpublishaddr": "172.25.XX.XX",
  "data": {
    "cause": "A user changed the Desired Capacity, changing the Total Capacity from \"1\" to \"0\".",
    "description": "Fail to remove Instances \"i-xxx\" (code:\"LifecycleActionResult.Abandon\", msg:\"Abandon lifecycleActionResult parameter caused the instance to rollback.\").",
    "startTime": "2022-09-06T06:29:23.000Z",
    "endTime": "2022-09-06T06:30:10.000Z",
    "expectNum": 1,
    "requestId": "WOSQ2zMxNTcZOoH1bu****",
    "scalingActivityId": "asa-xxx",
    "totalCapacity": 1
  }
}

data字段包含的参数解释如下表所示。

参数类型示例值描述
causeString
A user changed the Desired Capacity, changing the Total Capacity from \"1\" to \"0\"."
伸缩活动触发原因。
descriptionStringFail to remove Instances \"i-xxx\" (code:\"LifecycleActionResult.Abandon\", msg:\"Abandon lifecycleActionResult parameter caused the instance to rollback.\")."伸缩活动描述。
startTimeString2022-09-06T06:29:23.000Z伸缩活动开始时间。
endTimeString2022-09-06T06:30:10.000Z伸缩活动结束时间。
expectNumInt1伸缩活动期望扩容的容量值。
requestIdStringWOSQ2zMxNTcZOoH1b****请求ID。
scalingActivityIdStringasa-xxx伸缩活动ID。
totalCapacityString1伸缩活动结束后组内的容量值。

缩容伸缩活动部分成功

缩容伸缩活动部分成功时,事件总线EventBridge接收到的示例事件如下所示。

{
  "id": "45ef4dewdwe1-7c35-447a-bd93-fab****",
  "source": "acs.ess",
  "specversion": "1.0",
  "subject": "arn:acs:ess:cn-hangzhou:123456789xxxxxxx:scalinggroup/asg-xxxxx",
  "time": "2020-11-19T21:04:41Z",
  "type": "ess:ScalingActivity:ScaleInPartialSuccess",
  "aliyunaccountid": "123456789098****",
  "aliyunpublishtime": "2020-11-19T21:04:42Z",
  "aliyuneventbusname": "default",
  "aliyunregionid": "cn-hangzhou",
  "aliyunpublishaddr": "172.25.XX.XX",
  "data": {
    "cause": "A user changed the Desired Capacity, changing the Total Capacity from \"2\" to \"0\".",
    "description": "\"1\" ECS instances are removed",
    "startTime": "2022-09-06T06:29:23.000Z",
    "endTime": "2022-09-06T06:30:10.000Z",
    "expectNum": 1,
    "instanceIds": [
      "i-xxx"
    ],
    "requestId": "WOSQ2zMxNTcZOoH1bu****",
    "scalingActivityId": "asa-xxx",
    "totalCapacity": 1
  }
}

data字段包含的参数解释如下表所示。

参数类型示例值描述
causeString
A user changed the Desired Capacity, changing the Total Capacity from \"1\" to \"0\"."
伸缩活动触发原因。
descriptionStringFail to remove Instances \"i-xxx\" (code:\"LifecycleActionResult.Abandon\", msg:\"Abandon lifecycleActionResult parameter caused the instance to rollback.\")."伸缩活动描述。
startTimeString2022-09-06T06:29:23.000Z伸缩活动开始时间。
endTimeString2022-09-06T06:30:10.000Z伸缩活动结束时间。
expectNumInt1伸缩活动期望扩容的容量值。
requestIdStringWOSQ2zMxNTcZOoH1bu****请求ID。
scalingActivityIdStringasa-xxx伸缩活动ID。
instanceIdsArrayi-xxx缩容的实例ID列表。
totalCapacityInt1伸缩活动结束后组内的容量值。

缩容伸缩活动成功

缩容伸缩活动成功时,事件总线EventBridge接收到的示例事件如下所示。

{
  "id": "45ef4dewdwe1-7c35-447a-bd93-fab****",
  "source": "acs.ess",
  "specversion": "1.0",
  "subject": "arn:acs:ess:cn-hangzhou:123456789xxxxxxx:scalinggroup/asg-xxxxx",
  "time": "2020-11-19T21:04:41Z",
  "type": "ess:ScalingActivity:ScaleInSuccess",
  "aliyunaccountid": "123456789098****",
  "aliyunpublishtime": "2020-11-19T21:04:42Z",
  "aliyuneventbusname": "default",
  "aliyunregionid": "cn-hangzhou",
  "aliyunpublishaddr": "172.25.XX.XX",
  "data": {
    "cause": "A user changed the Desired Capacity, changing the Total Capacity from \"1\" to \"0\".",
    "description": "\"1\" ECS instances are removed",
    "startTime": "2022-09-06T06:29:23.000Z",
    "endTime": "2022-09-06T06:30:10.000Z",
    "expectNum": 1,
    "instanceIds": [
      "i-xxx"
    ],
    "requestId": "WOSQ2zMxNTcZOoH1bu****",
    "scalingActivityId": "asa-xxx",
    "totalCapacity": 0
  }
}

关于data字段包含的参数解释,请参见参数解释

扩容伸缩活动失败

扩容伸缩活动失败时,事件总线EventBridge接收到的示例事件如下所示。

{
  "id": "45ef4dewdwe1-7c35-447a-bd93-fab****",
  "source": "acs.ess",
  "specversion": "1.0",
  "subject": "arn:acs:ess:cn-hangzhou:123456789xxxxxxx:scalinggroup/asg-xxxxx",
  "time": "2020-11-19T21:04:41Z",
  "type": "ess:ScalingActivity:ScaleOutError",
  "aliyunaccountid": "123456789098****",
  "aliyunpublishtime": "2020-11-19T21:04:42Z",
  "aliyuneventbusname": "default",
  "aliyunregionid": "cn-hangzhou",
  "aliyunpublishaddr": "172.25.XX.XX",
  "data": {
    "cause": "A user changed the Desired Capacity, changing the Total Capacity from \"0\" to \"1\".",
    "description": "Fail to create Instances into scaling group(code:\"LifecycleActionResult.Abandon\", msg:\"Abandon lifecycleActionResult parameter caused the instance to rollback.\").",
    "startTime": "2022-09-06T06:29:23.000Z",
    "endTime": "2022-09-06T06:30:10.000Z",
    "expectNum": 1,
    "requestId": "WOSQ2zMxNTcZOoH1bu****",
    "scalingActivityId": "asa-xxx",
    "totalCapacity": 0
  }
}

关于data字段包含的参数解释,请参见参数解释

扩容伸缩活动部分成功

扩容伸缩活动部分成功时,事件总线EventBridge接收到的示例事件如下所示。

{
  "id": "45ef4dewdwe1-7c35-447a-bd93-fab****",
  "source": "acs.ess",
  "specversion": "1.0",
  "subject": "arn:acs:ess:cn-hangzhou:123456789xxxxxxx:scalinggroup/asg-xxxxx",
  "time": "2020-11-19T21:04:41Z",
  "type": "ess:ScalingActivity:ScaleOutPartialSuccess",
  "aliyunaccountid": "123456789098****",
  "aliyunpublishtime": "2020-11-19T21:04:42Z",
  "aliyuneventbusname": "default",
  "aliyunregionid": "cn-hangzhou",
  "aliyunpublishaddr": "172.25.XX.XX",
  "data": {
    "cause": "A user changed the Desired Capacity, changing the Total Capacity from \"0\" to \"2\".",
    "description": "\"1\" ECS instances are added",
    "startTime": "2022-09-06T06:29:23.000Z",
    "endTime": "2022-09-06T06:30:10.000Z",
    "expectNum": 2,
    "instanceIds": [
      "i-xxx"
    ],
    "requestId": "WOSQ2zMxNTcZOoH1bu****",
    "scalingActivityId": "asa-xxx",
    "totalCapacity": 1
  }
}

关于data字段包含的参数解释,请参见参数解释

扩容伸缩活动成功

扩容伸缩活动成功时,事件总线EventBridge接收到的示例事件如下所示。

{
  "id": "45ef4dewdwe1-7c35-447a-bd93-fab****",
  "source": "acs.ess",
  "specversion": "1.0",
  "subject": "arn:acs:ess:cn-hangzhou:123456789xxxxxxx:scalinggroup/asg-xxxxx",
  "time": "2020-11-19T21:04:41Z",
  "type": "ess:ScalingActivity:ScaleOutSuccess",
  "aliyunaccountid": "123456789098****",
  "aliyunpublishtime": "2020-11-19T21:04:42Z",
  "aliyuneventbusname": "default",
  "aliyunregionid": "cn-hangzhou",
  "aliyunpublishaddr": "172.25.XX.XX",
  "data": {
    "cause": "A user changed the Desired Capacity, changing the Total Capacity from \"0\" to \"1\".",
    "description": "\"1\" ECS instances are added",
    "startTime": "2022-09-06T06:29:23.000Z",
    "endTime": "2022-09-06T06:30:10.000Z",
    "expectNum": 1,
    "instanceIds": [
      "i-xxx"
    ],
    "requestId": "WOSQ2zMxNTcZOoH1bu****",
    "scalingActivityId": "asa-xxx",
    "totalCapacity": 1
  }
}

关于data字段包含的参数解释,请参见参数解释