tencent cloud

CreateNotificationConfiguration
最終更新日:2025-10-30 21:28:20
CreateNotificationConfiguration
最終更新日: 2025-10-30 21:28:20

1. API Description

Domain name for API request: as.intl.tencentcloudapi.com.

This API is used to create a notification.
This API is used to send notifications to a CMQ topic or queue with the following message content:.

{
    "Service": "Tencent Cloud Auto Scaling",
"CreatedTime": "2021-10-11T10:15:11Z", // Activity creation time.
    "AppId": "100000000",
"ActivityId": "asa-fznnvrja", // scaling activity ID.
This API is used to specify the scaling group ID.
"ActivityType": "SCALE_OUT",  // scaling activity type.
"StatusCode": "SUCCESSFUL".
    "Description": "Activity was launched in response to a difference between desired capacity and actual capacity,
This API is used to scale out 1 instance.
This API is used to set the activity start time.
"EndTime": "2021-10-11T10:15:32Z",    // activity end time.
"DetailedStatusMessageSet": [ // Collection of activity internal errors (non-empty does not mean activity failure).
        {
            "Code": "InvalidInstanceType",
            "Zone": "ap-guangzhou-6",
            "InstanceId": "",
            "InstanceChargeType": "POSTPAID_BY_HOUR",
            "SubnetId": "subnet-4t5mgeuu",
            "Message": "The specified instance type `S5.LARGE8` is invalid in `subnet-4t5mgeuu`, `ap-guangzhou-6`.",
            "InstanceType": "S5.LARGE8"
        }
    ]
}

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateNotificationConfiguration.
Version Yes String Common Params. The value used for this API: 2018-04-19.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
AutoScalingGroupId Yes String Scaling group ID. obtain the scaling group ID by logging in to the console (https://console.tencentcloud.com/autoscaling/group) or calling the api DescribeAutoScalingGroups (https://www.tencentcloud.com/document/api/377/20438?from_cn_redirect=1), and retrieve AutoScalingGroupId from the returned information.
NotificationTypes.N Yes Array of String Notification type, i.e., the set of types of notifications to be subscribed to. Value range:
  • SCALE_OUT_SUCCESSFUL: scale-out succeeded
  • SCALE_OUT_FAILED: scale-out failed
  • SCALE_IN_SUCCESSFUL: scale-in succeeded
  • SCALE_IN_FAILED: scale-in failed
  • REPLACE_UNHEALTHY_INSTANCE_SUCCESSFUL: unhealthy instance replacement succeeded
  • REPLACE_UNHEALTHY_INSTANCE_FAILED: unhealthy instance replacement failed
  • NotificationUserGroupIds.N No Array of String Notification GROUP ID, which is the USER GROUP ID collection. USER GROUP ID can be accessed through ListGroups. this parameter is valid only when TargetType is USER_GROUP.
    TargetType No String Notification receiver type. values as follows:.
  • USER_GROUP: user group
  • .
  • TDMQ_CMQ_TOPIC: tdmq cmq topic
  • .
  • TDMQ_CMQ_QUEUE: tdmq cmq queue
  • .
  • CMQ_QUEUE: CMQ QUEUE. CMQ is offline. currently, only TDMQ CMQ is recommended.
  • .
  • CMQ_TOPIC: specifies the CMQ TOPIC. CMQ is offline. currently, TDMQ CMQ is recommended for use.
  • .

    Default value: USER_GROUP.
    QueueName No String TDMQ CMQ QUEUE name. this field is required if TargetType value is TDMQ_CMQ_QUEUE.
    TopicName No String TDMQ CMQ TOPIC name. this field is required when TargetType is TDMQ_CMQ_TOPIC.

    3. Output Parameters

    Parameter Name Type Description
    AutoScalingNotificationId String Notification ID.
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Creating the notification policy for scale-out results

    Input Example

    POST / HTTP/1.1
    Host: as.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateNotificationConfiguration
    <Common request parameters>
    
    {
        "AutoScalingGroupId": "asg-12wjuh0s",
        "NotificationUserGroupIds": [
            "1678"
        ],
        "NotificationTypes": [
            "SCALE_OUT_FAILED",
            "SCALE_OUT_SUCCESSFUL"
        ]
    }

    Output Example

    {
        "Response": {
            "AutoScalingNotificationId": "asn-2sestqbr",
            "RequestId": "fb02c8bd-5f38-4786-91b6-0c6e06a88832"
        }
    }

    Example2 Creating a policy to send notifications to the specified message queue for scale-out failures

    Input Example

    POST / HTTP/1.1
    Host: as.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateNotificationConfiguration
    <Common request parameters>
    
    {
        "AutoScalingGroupId": "asg-pc2oqu2z",
        "NotificationTypes": [
            "SCALE_OUT_FAILED"
        ],
        "TargetType": "CMQ_QUEUE",
        "QueueName": "test-queue"
    }

    Output Example

    {
        "Response": {
            "AutoScalingNotificationId": "asn-03kyokwk",
            "RequestId": "8565bcc0-7b02-4e9c-ae9f-27e3d3d73e12"
        }
    }

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    InvalidParameter.ActionNotFound Invalid Action request.
    InvalidParameterValue.ConflictNotificationTarget Conflicting notification receiver type.
    InvalidParameterValue.InvalidAutoScalingGroupId Invalid scaling group ID.
    InvalidParameterValue.InvalidNotificationUserGroupId The notification group ID should be a numeric string.
    InvalidParameterValue.LimitExceeded The value exceeds the limit.
    InvalidParameterValue.UserGroupIdNotFound The user group does not exist.
    LimitExceeded The quota limit is exceeded.
    LimitExceeded.QuotaNotEnough You are short of the quota.
    MissingParameter Parameter missing.
    ResourceNotFound.AutoScalingGroupNotFound The scaling group does not exist.
    ResourceNotFound.CmqQueueNotFound The specified CMQ queue does not exist.
    ResourceNotFound.TDMQCMQQueueNotFound The TDMQ-CMQ queue doesn't exist.
    ResourceNotFound.TDMQCMQTopicNotFound The TDMQ-CMQ topic doesn't exist.
    ResourceUnavailable.CmqTopicHasNoSubscriber There are no subscribers for the specified CMQ topic.
    ResourceUnavailable.TDMQCMQTopicHasNoSubscriber The TDMQ-CMQ topic is not subscribed.
    この記事はお役に立ちましたか?
    営業担当者に お問い合わせ いただくか チケットを提出 してサポートを求めることができます。
    はい
    いいえ

    フィードバック