调用CreateNotificationConfiguration创建弹性伸缩事件及资源变化通知。

接口说明

您可以设置由云监控系统事件、消息服务MNS队列或消息服务MNS主题接收消息通知。当伸缩组发生指定类型的伸缩事件或者资源变化时,弹性伸缩会通知云监控或消息服务。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String CreateNotificationConfiguration

系统规定参数。取值:CreateNotificationConfiguration

ScalingGroupId String asg-bp1igpak5ft1flyp****

伸缩组的ID。

NotificationArn String acs:mns:cn-beijing:161456884340****:queue/modifyLifecycleHo****

通知对象标识符,设置本参数时支持以下通知方式:

  • 云监控,参数取值格式:acs:ess:{region-id}:{account-id}:cloudmonitor。
  • 消息服务MNS队列,参数取值格式:acs:mns:{region-id}:{account-id}:queue/{queuename}。
  • 消息服务MNS主题,参数取值格式:acs:mns:{region-id}:{account-id}:topic/{topicname}。

参数格式中的变量含义如下:

  • region-id:伸缩组所在的地域的ID。
  • account-id:阿里云账号ID。
  • queuename:MNS队列的名称。
  • topicname:MNS主题的名称。
RegionId String cn-beijing

伸缩组所属的地域ID。

NotificationType.N String AUTOSCALING:SCALE_OUT_SUCCESS

一类或者多类弹性伸缩事件及资源变化通知。N的取值范围:1~8,多个取值使用重复列表的形式。

您可以调用接口DescribeNotificationTypes查询参数取值。

返回数据

名称 类型 示例值 描述
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

请求ID。

示例

请求示例

http(s)://ess.aliyuncs.com/?Action=CreateNotificationConfiguration
&ScalingGroupId=asg-bp1igpak5ft1flyp****
&NotificationArn=acs:mns:cn-beijing:161456884340****:queue/modifyLifecycleHo****
&NotificationType=["AUTOSCALING:SCALE_OUT_SUCCESS"]
&RegionId=cn-beijing
&公共请求参数

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateNotificationConfigurationResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</CreateNotificationConfigurationResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

错误码

访问错误中心查看更多错误码。

HttpCode

错误码

错误信息

描述

400

InvalidNotificationArn

The specified parameter notificationArn is invalid.

指定的NotificationArn不合法。

400

InvalidNotificationTypes

The specified notification type is invalid.

指定的NotificationType.N不合法。

400

NotificationConfigurationExist

The specified notification configuration already exist for the scalingGroup.

指定的事件通知已经存在于当前伸缩组中。

400

NotificationConfigurationQuotaExceed.ForScalingGroup

NotificationConfiguration num exceed for the specified scalingGroup.

当前伸缩组配置的通知功能超出允许的上限值。

400

QueueNotExist

The specified queue queuename does not exist.

指定的MNS队列不存在。

400

TopicNotExist

The specified topic topicname does not exist.

指定的MNS主题不存在。

400

UnsupportedNotificationType.CurrentRegion

The NotificationType is not supported in the special region which scaling group belongs to.

当前地域不支持该通知方式。

404

InvalidScalingGroupId.NotFound

The specified scaling group does not exist.

指定的伸缩组不存在。