Event notifications automatically send messages to CloudMonitor, Message Service (MNS) topics, or MNS queues when specific events occur. This helps you stay informed about the status of your scaling groups and automate management. If an existing event notification no longer meets your business needs, you can call the ModifyNotificationConfiguration operation to modify the notification for Auto Scaling events and resource changes. You do not need to create a new event notification. However, you cannot change the notification method.
Usage notes
You can configure CloudMonitor system events, MNS queues, or MNS topics to receive notifications. When a specified type of scaling event or resource change occurs in a scaling group, Auto Scaling sends a notification to CloudMonitor or MNS.
Different event notifications in the same scaling group cannot use the same accepter.
For example, different event notifications cannot use the same CloudMonitor instance, MNS topic, or MNS queue.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
Action | String | Yes | CreateNotificationConfiguration | A required parameter. 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 object. The following notification methods are supported:
The variables in the preceding formats are described as follows:
|
NotificationType.N | String | No | AUTOSCALING:SCALE_OUT_SUCCESS | One or more types of notifications for Auto Scaling events and resource changes. The value of N can be an integer from 1 to 8. Specify multiple values in a repeated list. You can call the DescribeNotificationTypes operation to query the valid values of this parameter. |
RegionId | String | No | cn-beijing | The ID of the region to which the scaling group belongs. |
TimeZone | String | No | UTC+8 | The time zone of the notification. The offset from Coordinated Universal Time (UTC). Examples: UTC+8 and UTC-7. |
MessageEncoding | String | No | PlainText | The encoding method of the notification content. Valid values:
Default value: Base64. Note This parameter can be set only for MNS notifications. |
Response parameters
Parameter | Type | Example | Description |
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** | The ID of the request. |
Examples
Request example
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>Response example
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 more information about error codes, see the Error Center.
HTTP status code | Error code | Error message | Description |
400 | InvalidNotificationArn | The specified parameter notificationArn is invalid. | The specified NotificationArn is invalid. |
400 | InvalidNotificationTypes | The specified notification type is invalid. | The specified NotificationType.N is invalid. |
400 | NotificationConfigurationExist | The specified notification configuration already exist for the scalingGroup. | The specified event notification already exists in the scaling group. |
400 | NotificationConfigurationQuotaExceed.ForScalingGroup | NotificationConfiguration num exceed for the specified scalingGroup. | The number of notifications configured for the scaling group exceeds the quota. |
400 | QueueNotExist | The specified queue queuename does not exist. | The specified MNS queue does not exist. |
400 | TopicNotExist | The specified topic topicname does not exist. | The specified MNS topic does not exist. |
400 | UnsupportedNotificationType.CurrentRegion | The NotificationType is not supported in the special region which scaling group belongs to. | This notification method is not supported in the current region. |
400 | InvalidParameter.TimeZone | The specified parameter TimeZone is not valid. | The specified TimeZone parameter is invalid. |
404 | InvalidScalingGroupId.NotFound | The specified scaling group does not exist. | The specified scaling group does not exist. |