全部产品
Search
文档中心

:弹性伸缩事件

更新时间:Sep 03, 2024

本文介绍弹性伸缩通过操作审计、云监控和配置审计接入,作为事件源发布到事件总线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

EventBridge生命周期挂钩测试事件

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

A user changed the Desired Capacity, changing the Total Capacity from \"1\" to \"0\"."

伸缩活动触发原因。

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

A user changed the Desired Capacity, changing the Total Capacity from \"1\" to \"0\"."

伸缩活动触发原因。

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

生命周期挂钩默认结果。取值如下:

  • CONTINUE:继续响应弹性扩张活动或者继续响应弹性收缩活动。

  • ABANDON:直接释放弹性扩张活动创建出来的ECS实例或者直接将弹性收缩活动中的ECS实例从伸缩组移除。

  • ROLLBACK:针对弹性收缩活动,会拒绝释放ECS实例,进行回滚;针对弹性扩张活动,会直接释放创建出来的ECS实例,效果同ABANDON一样。

扩容生命周期挂钩

扩容生命周期挂钩时,事件总线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字段包含的参数解释,请参见参数解释