All Products
Search
Document Center

Auto Scaling:CreateNotificationConfiguration

Last Updated:Dec 23, 2024

Modifies event notification rules. Event notification rules support automatic sending of notifications to CloudMonitor, Simple Message Queue (SMQ, formerly MNS) topics, or SMQ queues when a specified type of events occur. This helps you understand the dynamics of your scaling group at the earliest opportunity and further automate resource management. If an existing event notification rule does not meet your business requirements, you can call the ModifyNotificationConfiguration operation to modify the event notification rule, without the need to create a new rule. Take not that you cannot modify the notification recipient of an event notification rule by calling this operation.

Usage notes

  • You can configure CloudMonitor system events, SMQ queues, or MNS topics to receive notifications. When a specified type of scaling event or resource change occurs in a scaling group, Auto Scaling notifies CloudMonitor or SMQ.

  • You cannot specify the same notification recipient for different event notification rules in a scaling group.

    For example, if you create multiple event notification rules in a scaling group, the event notification rules cannot share the same CloudMonitor or SMQ resource, such as the same SMQ topic or queue.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

CreateNotificationConfiguration

The operation that you want to perform. Set the value to CreateNotificationConfiguration.

ScalingGroupId

String

Yes

asg-bp1igpak5ft1flyp****

The ID of the scaling group.

NotificationArn

String

Yes

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

The Alibaba Cloud Resource Name (ARN) of the notification recipient. The following list describes the value formats of this parameter:

  • If you specify CloudMonitor as the notification recipient, specify the value in the acs:ess:{region-id}:{account-id}:cloudmonitor format.

  • If you specify an SMQ queue as the notification recipient, specify the value in the acs:mns:{region-id}:{account-id}:queue/{queuename} format.

  • If you specify an SMQ topic as the notification recipient, specify the value in the acs:mns:{region-id}:{account-id}:topic/{topicname} format.

The variables in the preceding value formats have the following meanings:

  • region-id: the region ID of the scaling group.

  • account-id: the ID of the Alibaba Cloud account.

  • queuename: the name of the SMQ queue.

  • topicname: the name of the SMQ topic.

NotificationType.N

String

No

AUTOSCALING:SCALE_OUT_SUCCESS

The type of the notification rule N for scaling events or resource changes. Valid values of N: 1 to 8. Specify multiple values in the repeated list form.

You can call the DescribeNotificationTypes operation to query the values of this parameter.

RegionId

String

No

cn-beijing

The region ID of the scaling group.

TimeZone

String

No

UTC+8

The time zone of notifications.

Specify the value in UTC. For example, a value of UTC+8 specifies that the time is 8 hours ahead of Coordinated Universal Time, and a value of UTC-7 specifies that the time is 7 hours behind Coordinated Universal Time.

Response parameters

Parameter

Type

Example

Description

RequestId

String

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

The request ID.

Examples

Sample requests

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
&<Common request parameters>

Sample success responses

XML format

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

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

JSON format

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

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

Error codes

For a list of error codes, see Service error codes.

HTTP status code

Error code

Description

Description

400

InvalidNotificationArn

The specified parameter notificationArn is invalid.

The value you assigned to NotificationArn is invalid.

400

InvalidNotificationTypes

The specified notification type is invalid.

The value you assigned to NotificationType.N is invalid.

400

NotificationConfigurationExist

The specified notification configuration already exist for the scalingGroup.

A notification rule for the scaling event already exists.

400

NotificationConfigurationQuotaExceed.ForScalingGroup

NotificationConfiguration num exceed for the specified scalingGroup.

The maximum number of notification rules that you can create in the scaling group has been reached.

400

QueueNotExist

The specified queue queuename does not exist.

The specified SMQ queue does not exist.

400

TopicNotExist

The specified topic topicname does not exist.

The specified SMQ topic does not exist.

400

UnsupportedNotificationType.CurrentRegion

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

The notification recipient is not supported in the current region.

400

InvalidParameter.TimeZone

The specified parameter TimeZone is not valid.

The value you assigned to TimeZone is invalid.

404

InvalidScalingGroupId.NotFound

The specified scaling group does not exist.

The specified scaling group does not exist.