本文介紹彈性伸縮通過操作審計、云監控和配置審計接入,作為事件源發布到事件總線EventBridge的事件類型。
事件類型
彈性伸縮支持發布到事件總線EventBridge的事件類型如下所示。
事件類型 | type參數值 |
ess:ScalingActivity:ScaleInError | |
ess:ScalingActivity:ScaleInPartialSuccess | |
ess:ScalingActivity:ScaleInSuccess | |
ess:ScalingActivity:ScaleOutError | |
ess:ScalingActivity:ScaleOutPartialSuccess | |
ess:ScalingActivity:ScaleOutSuccess | |
ess:LifecycleHook:ScaleIn | |
ess:LifecycleHook:ScaleOut | |
ess:LifecycleHook:Test | |
ess:ScalingActivity:ScaleInStart | |
ess:ScalingActivity:ScaleOutStart | |
阿里云平臺對資源執行的操作事件 | 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字段包含的參數解釋如下表所示。
參數 | 類型 | 示例值 | 描述 |
cause | String |
| 伸縮活動觸發原因。 |
description | String | Fail to remove Instances \"i-xxx\" (code:\"LifecycleActionResult.Abandon\", msg:\"Abandon lifecycleActionResult parameter caused the instance to rollback.\")." | 伸縮活動描述。 |
startTime | String | 2022-09-06T06:29:23.000Z | 伸縮活動開始時間。 |
endTime | String | 2022-09-06T06:30:10.000Z | 伸縮活動結束時間。 |
expectNum | Int | 1 | 伸縮活動期望擴容的容量值。 |
requestId | String | WOSQ2zMxNTcZOoH1b**** | 請求ID。 |
scalingActivityId | String | asa-xxx | 伸縮活動ID。 |
totalCapacity | String | 1 | 伸縮活動結束后組內的容量值。 |
縮容伸縮活動部分成功
縮容伸縮活動部分成功時,事件總線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字段包含的參數解釋如下表所示。
參數 | 類型 | 示例值 | 描述 |
cause | String |
| 伸縮活動觸發原因。 |
description | String | Fail to remove Instances \"i-xxx\" (code:\"LifecycleActionResult.Abandon\", msg:\"Abandon lifecycleActionResult parameter caused the instance to rollback.\")." | 伸縮活動描述。 |
startTime | String | 2022-09-06T06:29:23.000Z | 伸縮活動開始時間。 |
endTime | String | 2022-09-06T06:30:10.000Z | 伸縮活動結束時間。 |
expectNum | Int | 1 | 伸縮活動期望擴容的容量值。 |
requestId | String | WOSQ2zMxNTcZOoH1bu**** | 請求ID。 |
scalingActivityId | String | asa-xxx | 伸縮活動ID。 |
instanceIds | Array | i-xxx | 縮容的實例ID列表。 |
totalCapacity | Int | 1 | 伸縮活動結束后組內的容量值。 |
縮容伸縮活動成功
縮容伸縮活動成功時,事件總線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字段包含的參數解釋,請參見參數解釋。
縮容生命周期掛鉤
縮容生命周期掛鉤時,事件總線EventBridge接收到的示例事件如下所示。
{
"id": "45ef4dewdwe1-7c35-447a-bd93-fab****",
"source": "acs.ess",
"specversion": "1.0",
"subject": "arn:acs:ess:cn-hangzhou:123456789xxxxxxx:scalinggroup/asg-xxxxx",
"time": "2023-05-19T21:04:41Z",
"type": "ess:LifecycleHook:ScaleIn",
"aliyunaccountid": "123456789098****",
"aliyunpublishtime": "2023-05-19T21:04:42Z",
"aliyuneventbusname": "default",
"aliyunregionid": "cn-hangzhou",
"aliyunpublishaddr": "172.25.XX.XX",
"data": {
"instanceIds": [
"i-xxx"
],
"lifecycleHookId": "ash-xxx",
"lifecycleActionToken": "XXXX",
"scalingGroupId": "asg-xxx",
"scalingActivityId": "asa-xxx",
"notificationMetadata": "lifecycleHook metadata example",
"defaultResult": "CONTINUE"
}
}
data字段包含的參數解釋如下表所示。
參數 | 類型 | 示例值 | 描述 |
instanceIds | Array | [ "i-xxx" ] | 縮容實例ID列表。 |
lifecycleHookId | String | ash-xxx | 生命周期掛鉤ID。 |
lifecycleActionToken | String | XXXX | 伸縮活動的等待狀態標識符。 |
scalingGroupId | String | asg-xxx | 伸縮組ID。 |
scalingActivityId | String | asa-xxx | 伸縮活動ID。 |
notificationMetadata | String | lifecycleHook metadata example | 生命周期掛鉤通知信息。 |
defaultResult | String | CONTINUE | 生命周期掛鉤默認結果。取值如下:
|
擴容生命周期掛鉤
擴容生命周期掛鉤時,事件總線EventBridge接收到的示例事件如下所示。
{
"id": "45ef4dewdwe1-7c35-447a-bd93-fab****",
"source": "acs.ess",
"specversion": "1.0",
"subject": "arn:acs:ess:cn-hangzhou:123456789xxxxxxx:scalinggroup/asg-xxxxx",
"time": "2023-05-19T21:04:41Z",
"type": "ess:LifecycleHook:ScaleOut",
"aliyunaccountid": "123456789098****",
"aliyunpublishtime": "2023-05-19T21:04:42Z",
"aliyuneventbusname": "default",
"aliyunregionid": "cn-hangzhou",
"aliyunpublishaddr": "172.25.XX.XX",
"data": {
"instanceIds": [
"i-xxx"
],
"lifecycleHookId": "ash-xxx",
"lifecycleActionToken": "XXXX",
"scalingGroupId": "asg-xxx",
"scalingActivityId": "asa-xxx",
"notificationMetadata": "lifecycleHook metadata example",
"defaultResult": "CONTINUE"
}
}
關于data字段包含的參數解釋,請參見參數解釋。
EventBridge生命周期掛鉤測試事件
當EventBridge生命周期掛鉤測試事件推送時,事件總線EventBridge接收到的示例事件如下所示。
{
"id": "45ef4dewdwe1-7c35-447a-bd93-fab****",
"source": "acs.ess",
"specversion": "1.0",
"subject": "arn:acs:ess:cn-hangzhou:123456789xxxxxxx:scalinggroup/asg-xxxxx",
"time": "2023-05-19T21:04:41Z",
"type": "ess:LifecycleHook:Test",
"aliyunaccountid": "123456789098****",
"aliyunpublishtime": "2023-05-19T21:04:42Z",
"aliyuneventbusname": "default",
"aliyunregionid": "cn-hangzhou",
"aliyunpublishaddr": "172.25.XX.XX",
"data": {
"scalingGroupId": "asg-xxx"
}
}
關于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:ScaleInStart",
"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",
"expectNum": 1,
"requestId": "WOSQ2zMxNTcZOoH1bu****",
"scalingActivityId": "asa-xxx",
"totalCapacity": 1
}
}
data字段包含的參數解釋如下表所示。
參數 | 類型 | 示例值 | 描述 |
cause | string | A user changed the Desired Capacity, changing the Total Capacity from \"1\" to \"0\". | 伸縮活動觸發原因。 |
description | string | \"1\" ECS instances are removed" | 伸縮活動描述。 |
startTime | string | 2022-09-06T06:29:23.000Z | 伸縮活動開始時間。 |
expectNum | Int | 1 | 伸縮活動期望縮容的容量值。 |
requestId | string | WOSQ2zMxNTcZOoH1bu**** | 伸縮活動請求ID。 |
scalingActivityId | string | asa-xxx | 伸縮活動ID。 |
totalCapacity | Int | 1 | 伸縮活動結束后組內的容量值。 |
擴容伸縮活動開始
當擴容伸縮活動開始時,事件總線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:ScaleOutStart",
"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",
"expectNum": 2,
"requestId": "WOSQ2zMxNTcZOoH1bu****",
"scalingActivityId": "asa-xxx",
"totalCapacity": 1
}
}
關于data字段包含的參數解釋,請參見參數解釋。