tencent cloud

AddMetricScaleStrategy
Last updated: 2025-11-13 20:48:59
AddMetricScaleStrategy
Last updated: 2025-11-13 20:48:59

1. API Description

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

This API is used to add scaling rules by load and time.

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: AddMetricScaleStrategy.
Version Yes String Common Params. The value used for this API: 2019-01-03.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
InstanceId Yes String Instance ID.
StrategyType Yes Integer 1 indicates scaling by load rules. 2 indicates scaling by time rules. This parameter is required and should match the following rule policy.
LoadAutoScaleStrategy No LoadAutoScaleStrategy Load-based scale-out rules.
TimeAutoScaleStrategy No TimeAutoScaleStrategy Rule for time-based scaling

3. Output Parameters

Parameter Name Type Description
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 Adding a Successful Instance of Scaling Rules

Input Example

POST / HTTP/1.1
Host: emr.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: AddMetricScaleStrategy
<Common request parameters>

{
    "InstanceId": "emr-123",
    "StrategyType": 0,
    "LoadAutoScaleStrategy": {
        "CalmDownTime": 0,
        "ConfigGroupAssigned": "{\"HDFS-3.2.2\":-1,\"YARN-3.2.2\":-1}",
        "GraceDownFlag": false,
        "GroupId": 109,
        "LoadMetricsConditions": {
            "LoadMetrics": [
                {
                    "Conditions": [
                        {
                            "CompareMethod": 1,
                            "Threshold": 0
                        }
                    ],
                    "LoadMetrics": "AvailableMB#root",
                    "MetricId": 3,
                    "StatisticPeriod": 60,
                    "TriggerThreshold": 1
                }
            ]
        },
        "Priority": 0,
        "MeasureMethod": "INSTANCE",
        "ScaleAction": 2,
        "ScaleNum": 1,
        "StrategyName": "Parallel Load-re04",
        "StrategyStatus": 1
    },
    "TimeAutoScaleStrategy": {
        "CompensateFlag": 0,
        "ConfigGroupAssigned": "{\"HDFS-3.2.2\":-1,\"YARN-3.2.2\":-1}",
        "GraceDownFlag": false,
        "GroupId": 27,
        "IntervalTime": 0,
        "MeasureMethod": "INSTANCE",
        "RepeatStrategy": {
            "Expire": "2025-11-05 23:59:59",
            "NotRepeat": {
                "ExecuteAt": "2024-11-05 14:43:00"
            },
            "RepeatType": "NONE"
        },
        "Priority": 0,
        "RetryValidTime": 60,
        "ScaleAction": 1,
        "ScaleNum": 10,
        "ServiceNodeInfo": [
            7
        ],
        "SoftDeployInfo": [
            1,
            2
        ],
        "StrategyName": "add",
        "StrategyStatus": 1,
        "TerminatePolicy": "DEFAULT"
    }
}

Output Example

{
    "Response": {
        "RequestId": "e3f82d54-6fa6-49c2-a479-8d2f5cf77f91"
    }
}

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
FailedOperation.MoreStrategyNotAllowed No more scaling rules are allowed.
InternalError.CamCgwError An error occurred while calling another service API.
InvalidParameter.InvalidCompareMethod Illegal metric comparison method.
InvalidParameter.InvalidConditionNum At least one trigger condition is required.
InvalidParameter.InvalidParamterInvalidSoftInfo The SoftInfo parameter is invalid.
InvalidParameter.InvalidProcessMethod Illegal metric processing method.
InvalidParameter.InvalidScaleAction Invalid scaling action.
InvalidParameter.InvalidSoftWare Incorrect parameter.
InvalidParameter.InvalidStrategy Parameter error.
InvalidParameter.InvalidStrategySpec Invalid specification.
InvalidParameter.InvalidStrategyType Unsupported scaling policy type.
InvalidParameter.InvalidTimeLayout Parameter error.
InvalidParameter.RepeatedExecutionTime Duplicate execution time.
InvalidParameter.RepeatedStrategyName Repeated scaling rule name.
UnauthorizedOperation.CheckCamAuth Unauthorized operation.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback