全部產品
Search
文件中心

Auto Scaling:CreateNotificationConfiguration

更新時間:Jan 14, 2025

事件通知支援在發生指定類型的事件後,自動發送訊息到CloudMonitor、MNS主題和MNS隊列,可以協助您及時掌握伸縮組的動態,進一步實現自動化管理。如果當前事件通知的類型不再滿足業務需求,您可以調用API ModifyNotificationConfiguration修改Auto Scaling事件及資源變化通知,您無需重新建立新的事件通知,但不支援修改事件通知的通知方式。

介面說明

  • 您可以設定由CloudMonitor系統事件、Message ServiceMNS隊列或Message ServiceMNS主題接收訊息通知。當伸縮組發生指定類型的伸縮事件或者資源變化時,Auto Scaling會通知CloudMonitor或Message Service。
  • 同一個伸縮組內的不同事件通知不可重複使用同一個接收端。

    例如,不同的事件通知不能同時使用同一個CloudMonitor、同一個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****

通知物件識別碼,設定本參數時支援以下通知方式:

  • CloudMonitor,參數取值格式: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主題的名稱。
NotificationType.N String AUTOSCALING:SCALE_OUT_SUCCESS

一類或者多類Auto Scaling事件及資源變化通知。N的取值範圍:1~8,多個取值使用重複列表的形式。

您可以調用介面DescribeNotificationTypes查詢參數取值。

RegionId String cn-beijing

伸縮組所屬的地區ID。

TimeZone String UTC+8

訊息通知的時區。

時區相對於國際標準時間的位移量: 如 UTC+8(東八區)、UTC-7(西七區)等。

返回資料

名稱

類型

樣本值

描述

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

請求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-A3DC0DE3****</RequestId>
</CreateNotificationConfigurationResponse>

JSON格式

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

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

錯誤碼

訪問錯誤中心查看更多錯誤碼。

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.

當前地區不支援該通知方式。

400

InvalidParameter.TimeZone

The specified parameter TimeZone is not valid.

指定的參數TimeZone不合法。

404

InvalidScalingGroupId.NotFound

The specified scaling group does not exist.

指定的伸縮組不存在。