本文介紹Auto Scaling通過Action Trail、CloudMonitor和配置審計接入,作為事件來源發布到事件匯流排EventBridge的事件類型。
事件類型
Auto Scaling支援發布到事件匯流排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 |
Auto Scaling組縮容伸縮活動失敗 | ess:CloudMonitor:AUTOSCALING[SCALEINERROR] |
Auto Scaling組縮容伸縮活動開始 | ess:CloudMonitor:AUTOSCALING[SCALEINSTART] |
Auto Scaling組縮容伸縮活動成功 | ess:CloudMonitor:AUTOSCALING[SCALEINSUCCESS] |
Auto Scaling組縮容伸縮活動部分成功 | ess:CloudMonitor:AUTOSCALING[SCALEINWARN] |
Auto Scaling組擴容伸縮活動失敗 | ess:CloudMonitor:AUTOSCALING[SCALEOUTERROR] |
Auto Scaling組擴容伸縮活動開始 | ess:CloudMonitor:AUTOSCALING[SCALEOUTSTART] |
Auto Scaling組擴容伸縮活動成功 | ess:CloudMonitor:AUTOSCALING[SCALEOUTSUCCESS] |
Auto Scaling組擴容伸縮活動部分成功 | ess:CloudMonitor:AUTOSCALING[SCALEOUTWARN] |
Auto Scaling組伸縮活動執行被拒絕 | 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欄位包含的參數解釋,請參見參數解釋。