putScalingPolicy

Prev Next

Available in VPC

Create or edit a scaling policy for Auto Scaling Group.

Syntax

The putScalingPolicy syntax is as follows:

./ncloud vautoscaling putScalingPolicy \
    --autoScalingGroupNo <auto-scaling-group-no> \
    --adjustmentTypeCode <CHANG|PRCNT|EXACT> \
    --scalingAdjustment <scaling-adjustment> \
    [--policyNo <policy-no>] \
    [--policyName <policy-name>] \
    [--minAdjustmentStep <min-adjustment-step>] \
    [--coolDown <cooldown>] \
    [--regionCode <KR|SGN|JPN>] \
    [--output <json|xml>]

Options

This section describes the options available when running putScalingPolicy.

Required options

The following options are required for putScalingPolicy.

Options Type Required Description
--autoScalingGroupNo String Required Auto Scaling Group number
--adjustmentTypeCode String Required Adjustment type code
  • CHANG | PRCNT | EXACT
    • CHANG: Scale change in capacity.
    • PRCNT: Percent change in capacity.
    • EXACT: Exact capacity to set (fixed value).
  • See getAdjustmentTypeList.
--scalingAdjustment Integer Required Adjustment value
  • Specify based on adjustment type.
    • CHANG: -2147483648 or higher.
    • PRCNT: -100 or higher.
    • EXACT: 0 or higher.
  • Up to 2147483647 can be entered.
  • CHANG/PRCNT values decrease when negative.
--policyNo String Conditional Policy number
  • Not required when creating a policy.
  • When editing a policy, either policyNo or policyName is required.
  • See getAutoScalingPolicyList.
--policyName String Conditional Policy name
  • Entering a new name creates a policy.
    • Enter 1-255 characters, including lowercase English letters, numbers, and special character -.
    • The string must start with a lowercase English letter and end with a lowercase English letter or number.
  • Entering an existing name edits the policy.
  • Required when creating a policy.
  • When editing a policy, either policyNo or policyName is required.
  • See getAutoScalingPolicyList.

Optional options

These are the optional options for putScalingPolicy. Options that are not specified will use their default values.

Options Type Required Description
--minAdjustmentStep Integer Optional Minimum adjustment range
  • 1-2147483647
  • Adjusts the number of server instances by the minimum adjustment range.
  • Valid only when adjustmentTypeCode is PRCNT.
--coolDown Integer Optional Cooldown (second)
  • 0-2147483647 (default: 300)
  • Monitoring wait time to prepare servers after scaling

Common options

For information on options commonly used in the vautoscaling command, see Auto Scaling (VPC) options.

Examples

If the request to create or edit a scaling policy is successful, the configuration information for the scaling policy is returned.

Command

The command example is as follows:

./ncloud vautoscaling putScalingPolicy \
    --autoScalingGroupNo 20461037 \
    --policyName policy-01 \
    --adjustmentTypeCode CHANG \
    --scalingAdjustment 1 \
    --coolDown 300 \
    --regionCode KR \
    --output json

Output

The output example is as follows:

{
    "putScalingPolicyResponse": {
        "totalRows": 1,
        "scalingPolicyList": [
            {
                "autoScalingGroupNo": "20461037",
                "policyNo": "28470019",
                "policyName": "policy-01",
                "adjustmentType": {
                    "code": "CHANG",
                    "codeName": "Capacity change amount"
                },
                "scalingAdjustment": 1,
                "coolDown": 300
            }
        ],
        "requestId": "a7b8c9d0-e1f2-3456-abcd-789012345678",
        "returnCode": "0",
        "returnMessage": "success"
    }
}