Creates an event notification.

Description

You can configure CloudMonitor system events, Message Service (MNS) queues, or MNS topics to receive notifications. When a specified type of scaling activity or resource change occurs in a scaling group, Auto Scaling notifies CloudMonitor or MNS.

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 notified party. The following list describes the value formats of this parameter:

  • If the notified party is CloudMonitor, the value format of this parameter is acs:ess:{region-id}:{account-id}:cloudmonitor.
  • If the notified party is an MNS queue, the value format of this parameter is acs:mns:{region-id}:{account-id}:queue/{queuename}.
  • If the notified party is an MNS topic, the value format of this parameter is acs:mns:{region-id}:{account-id}:topic/{topicname}.

The variables in the preceding 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 MNS queue.
  • topicname: the name of the MNS topic.
RegionId String No cn-beijing

The ID of the region where the scaling group resides.

NotificationType.N String Yes AUTOSCALING:SCALE_OUT_SUCCESS

The type of notification N for scaling activities 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.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

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-A3DC0DE3C83E</RequestId>
</CreateNotificationConfigurationResponse>

JSON format

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

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

Error codes

For a list of error codes, visit the API Error Center.

HTTP status code

Error code

Error message

Description

400

InvalidNotificationArn

The specified parameter notificationArn is invalid.

The error message returned because the value that you specified for the NotificationArn parameter is invalid.

400

InvalidNotificationTypes

The specified notification type is invalid.

The error message returned because the value that you specified for the NotificationType.N parameter is invalid.

400

NotificationConfigurationExist

The specified notification configuration already exist for the scalingGroup.

The error message returned because the specified event notification already exists in the scaling group.

400

NotificationConfigurationQuotaExceed.ForScalingGroup

NotificationConfiguration num exceed for the specified scalingGroup.

The error message returned because the maximum number of notifications allowed for the scaling group has been reached.

400

QueueNotExist

The specified queue queuename does not exist.

The error message returned because the specified MNS queue does not exist.

400

TopicNotExist

The specified topic topicname does not exist.

The error message returned because the specified MNS topic does not exist.

400

UnsupportedNotificationType.CurrentRegion

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

The error message returned because the specified notification type is not supported in the region where the scaling group resides.

404

InvalidScalingGroupId.NotFound

The specified scaling group does not exist.

The error message returned because the specified scaling group does not exist.