You can call this operation to create a scaling configuration.

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
ScalingGroupId String Yes AG6CQdPU8OKdwLjgZcJ****

The ID of the scaling group to which the scaling configuration belongs.

Action String No CreateScalingConfiguration

The operation that you want to perform. Set the value to CreateScalingConfiguration.

Cpu Integer No 2

The number of vCPUs.

You can specify the number of vCPUs and the amount of memory to define the range of instance types. For example, to specify instance types that have 2 vCPUs and 16 GiB memory, set the value of Cpu to 2 and the value of Memory to 16. Auto Scaling uses the properties of instances such as its storage I/O performance and zone to determine a set of available instances types. Auto Scaling then creates instances of the type that is the most cost-effective out of the available types.

Note This instance type range takes effect only when cost optimization is enabled and the scaling configuration does not have a specified instance type.
DataDisk.N.Category String No cloud_ssd

The category of data disk N. Valid values of N: 1 to 16. Valid values:

  • cloud: basic disk. The DeleteWithInstance attribute of a basic disk created together with the instance is true.
  • cloud_efficiency: ultra disk.
  • cloud_ssd: standard SSD.
  • ephemeral_ssd: local SSD.
  • cloud_essd: enhanced SSD.

Default value: cloud

DataDisk.N.DeleteWithInstance Boolean No true

Specifies whether data disk N is to be released with its attached instance. Valid values of N: 1 to 16. Valid values:

  • true: releases the data disk with its attached instance.
  • false: retains the data disk when the attached instance is released.

Default value: true

This parameter is valid only for independently created disks, whose DataDisk.N.Category parameter is set to cloud, cloud_efficiency, or cloud_ssd. An error will be returned if you set this parameter for other disks.

DataDisk.N.Description String No FinanceDept

The description of data disk N. Valid values of N: 1 to 16. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

DataDisk.N.Device String No /dev/xvdb

The mount point of data disk N. Valid values of N: 1 to 16. If this parameter is not specified, the system automatically allocates a mount point to created ECS instances. The name of the mount point ranges from /dev/xvdb to /dev/xvdz in alphabetical order.

DataDisk.N.DiskName String No cloud_ssdData

The name of data disk N. Valid values of N: 1 to 16. It must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

Default value: null

DataDisk.N.Encrypted String No false

Specifies whether data disk N is to be encrypted. Valid values of N: 1 to 16. Valid values:

  • true: encrypted
  • false: not encrypted

Default value: false

DataDisk.N.KMSKeyId String No 0e478b7a-4262-4802-b8cb-00d3fb40826X

The CMK ID for data disk N. Valid values of N: 1 to 16.

DataDisk.N.Size Integer No 100

The size of data disk N. Unit: GiB. Valid values of N: 1 to 16. Valid values:

  • cloud: 5 to 2000
  • cloud_efficiency: 20 to 32768
  • cloud_ssd: 20 to 32768
  • ephemeral_ssd: 5 to 800

If this parameter is specified, the data disk size must be greater than or equal to the size of the snapshot specified by SnapshotId.

DataDisk.N.SnapshotId String No s-280s7****

The ID of the snapshot used to create data disk N. Valid values of N: 1 to 16. When this parameter is specified, the DataDisk.N.Size parameter is ignored. The size of the disk will be the same as that of the specified snapshot.

If you specify a snapshot that was created on or before July 15, 2013, the operation fails and returns InvalidSnapshot.TooOld.

DeploymentSetId String No ds-bp1frxuzdg87zh4pz****

The ID of the deployment set to which the ECS instance belongs.

HostName String No Host****

The name of the host where the created ECS instances reside. It cannot start or end with a period (.) or hyphen (-). It cannot contain consecutive periods (.) or hyphens (-). Naming conventions:

  • Windows instances: The name must be 2 to 15 characters in length. It can contain uppercase or lowercase letters, digits, and hyphens (-). It cannot contain periods (.) or contain only digits.
  • Other instances such as Linux instances: The name must be 2 to 64 characters in length. It can be segments separated by periods (.). Each segment can contain uppercase or lowercase letters, digits, and hyphens (-).
HpcClusterId String No hpc-clusterid

The ID of the E-HPC cluster to which the ECS instance belongs.

ImageId String No centos6u5_64_20G_aliaegis****.vhd

The ID of the image file that you specified when you create the instance.

ImageName String No myimage

The name of the image file. Image names must be unique within a region. This parameter is ignored if ImageId is specified.

Marketplace images cannot be specified by the ImageName parameter.

InstanceDescription String No FinaceDept

The description of the ECS instance. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

InstanceName String No Instance****

The name of the instance that is created based on the current scaling configuration.

InstanceType String No ecs.t1.xsmall

The single instance type from which ECS instances are to be created. For more information, see Instance families.

InstanceTypes.N RepeatList No ecs.t1.xsmall.

The instance types from which ECS instances can be created. If you specify this parameter, InstanceType is ignored. You can specify a maximum of 10 instance types that can be used for a scaling configuration. Valid values of N: 1 to 10.

N represents the priority of an instance type in the scaling configuration. A lower value of N indicates a higher priority. Auto Scaling creates instances in order of priority. If an instance of the highest priority type cannot be created, Auto Scaling will create an instance of the next highest priority type.

InternetChargeType String No PayByTraffic

The billing method of the network bandwidth. Valid values:

  • PayByTraffic: Users pay for the actual traffic used. The InternetMaxBandwidthOut parameter only specifies the upper limit of available bandwidth when this parameter is specified.
InternetMaxBandwidthIn Integer No 100

The maximum inbound bandwidth from the public network. Unit: Mbit/s. Valid values: 1 to 200.

Default value: 200. This parameter is not used for billing because the inbound traffic to instances is free of charge.

InternetMaxBandwidthOut Integer No 50

The maximum outbound bandwidth to the public network. Unit: Mbit/s. Valid values: 0 to 100.

  • If InternetChargeType is set to PayByTraffic and this parameter is not specified, an error is returned.
IoOptimized String No optimized

Specifies whether the instance is an I/O optimized instance. The default value for phased-out instance types is none, while that for other instances is optimized. Valid values:

  • none
  • optimized
KeyPairName String No KeyPairTest

The name of the key pair used to log on to the ECS instance.

  • Ignore this parameter if you are creating an ECS Windows instance. The default value is null.
  • By default, the username and password authentication method is disabled for ECS Linux instances.
LoadBalancerWeight Integer No 50

The weight of the backend server. Valid values: 0 to 100.

Default value: 50

Memory Integer No 16

The amount of memory.

You can specify the number of vCPUs and the amount of memory to define the range of instance types. For example, to specify instance types that have 2 vCPUs and 16 GiB memory, set the value of Cpu to 2 and the value of Memory to 16. Auto Scaling uses the properties of instances such as its storage I/O performance and zone to determine a set of available instances types. Auto Scaling then creates instances of the type that is the most cost-effective out of the available types.

Note This instance type range takes effect only when cost optimization is enabled and the scaling configuration does not have a specified instance type.
Password String No 123-abcABC

The password of the ECS instance. The password must be 8 to 30 characters in length. It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include

( ) ` ~ ! @ # $ % ^ & * - _ + = \ | { } [ ] : ; ' < > , . ? /

The password of Windows-based instances cannot start with a forward slash (/).

Note For security reasons, we recommend that you use HTTPS to send requests if the Password parameter is specified.
PasswordInherit Boolean No false

Specifies whether to use the preconfigured password of the specified image. To use this parameter, ensure that a password is configured for the specified image.

RamRoleName String No RamRoleTest

The name of the RAM role associated with an ECS instance. This name is provided and maintained by RAM. You can call the ListRoles operation to query the list of RAM role names. For more information about how to create a RAM role, see CreateRole.

ResourceGroupId String No rg-resource****

The ID of the resource group to which the ECS instance belongs.

ScalingConfigurationName String No Test_ sc

The name of the scaling configuration. It must be 2 to 40 characters in length. It must start with a digit, uppercase letter, or lowercase letter. It can contain letters, digits, underscores (_), hyphens (-), and periods (.).

The name of the scaling configuration must be unique within a scaling group. If this parameter is not specified, the value of ScalingConfigurationId is used.

SecurityEnhancementStrategy String No Active

Specifies whether to enable security hardening. Valid values:

  • Active: enables security hardening for public images
  • Deactive: disables security hardening for all images
SecurityGroupId String No sg-280ih****

The ID of the security group to which the ECS instance belongs. ECS instances in the same security group can access each other.

SecurityGroupIds.N RepeatList No sg-bp18kz60mefs****

Specifies the ID of security group N to add ECS instances to. The valid values of N depend on the maximum number of security groups to which an instance can be add. For more information, see the Security groups section in Limits.

Note You cannot specify SecurityGroupId and SecurityGroupIds.N at the same time.
SpotPriceLimit.N.InstanceType String No ecs.t1.xsmall

The instance type of preemptible instance N. Valid values of N: 1 to 10. This parameter takes effect only when the SpotStrategy parameter is set to SpotWithPriceLimit.

SpotPriceLimit.N.PriceLimit Float No 0.5

The price limit of preemptible instance N. Valid values of N: 1 to 10. This parameter takes effect only when the SpotStrategy parameter is set to SpotWithPriceLimit.

SpotStrategy String No NoSpot

The preemption strategy to be applied to pay-as-you-go instances. Valid values:

  • NoSpot: a pay-as-you-go instance
  • SpotWithPriceLimit: a preemptible instance with a maximum hourly price
  • SpotAsPriceGo: an instance that is billed based on the actual market price

Default value: NoSpot

SystemDisk.Category String No cloud_ssd

The category of the system disk. Valid values:

  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: standard SSD
  • ephemeral_ssd: local SSD
  • cloud_essd: enhanced SSD

The default value is cloud for instances of generation I instance types (non I/O optimized instances). For other instances, the default value is cloud_efficiency.

SystemDisk.Description String No FinanceDept

The description of the system disk. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

SystemDisk.DiskName String No cloud_ssdSystem

The name of the system disk. It must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

Default value: null

SystemDisk.Size Integer No 100

The size of the system disk. Unit: GiB. Valid values:

  • cloud: 40 to 500
  • cloud_efficiency: 40 to 500
  • cloud_ssd: 40 to 500
  • ephemeral_ssd: 40 to 500

Default value: max{40, ImageSize}

The specified value must be greater than or equal to max{40, ImageSize}.

Tags String No {"key1":"value1","key2":"value2", ... "key5":"value5"}

The tags of the ECS instance. Tags must be specified as key-value pairs. A maximum of five tags can be specified. The following rules apply to keys and values:

  • A key can be a maximum of 64 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://. You cannot specify an empty string as a key.
  • A value can be a maximum of 128 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://. You can specify an empty string as a value.
UserData String No echo hello ecs!

The user data of the ECS instance. It must be encoded in Base64 format. The maximum size of the raw data is 16 KB.

Response parameters

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

The ID of the request.

ScalingConfigurationId String eOs27Kb0oXvQcUYjEGel****

The ID of the scaling configuration.

Examples

Sample requests


http(s)://[Endpoint]/? Action=CreateScalingConfiguration
&ScalingGroupId=AG6CQdPU8OKdwLjgZcJ****
&SecurityGroupId=sg-280ih****
&<Common request parameters>

Sample success responses

XML format

<CreateScalingConfigurationResponse>
      <ScalingConfigurationId>eOs27Kb0oXvQcUYjEGel****</ScalingConfigurationId>
      <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</CreateScalingConfigurationResponse>

JSON format

{
	"ScalingConfigurationId":"eOs27Kb0oXvQcUYjEGel****",
	"RequestId":"473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

For more information about error codes, visit API Error Center.

HTTP status code

Error code

Error message

Description

400

InstanceType.Mismatch

The specified scaling configuration and existing active scaling configuration have different instance type.

The error message returned because the instance types of the specified scaling configuration and the current scaling configuration are different.

404

InvalidDataDiskSnapshotId.NotFound

Snapshot "XXX" does not exist.

The error message returned because the specified snapshot does not exist.

400

InvalidDataDiskSnapshotId.SizeNotSupported

The capacity of snapshot "XXX" exceeds the size limit of the specified disk category.

The error message returned because the size of the specified snapshot has exceeded the maximum size of the specified disk category.

403

InvalidDevice.InUse

Device "XXX" has been occupied.

The error message returned because the mount point of the data disk is already occupied.

400

InvalidImageId.InstanceTypeMismatch

The specified image does not support the specified instance type.

The error message returned because the specified image does not support the specified instance type.

404

InvalidImageId.NotFound

The specified image does not exist.

The error message returned because the specified image does not exist in the current account.

400

InvalidKeyPairName.NotFound

The specified KeyPairName does not exist in our records.

The error message returned because the name of the specified key pair does not exist.

400

InvalidNetworkType.ForRAMRole

RAMRole can't be used For classic instance.

The error message returned because the network type of the instance is classic network that does not support the RamRoleName parameter.

400

InvalidParameter

The specified value of parameter KeyPairName is not valid.

The error message returned because the specified instance OS is Windows that does not support the KeyPairName parameter.

400

InvalidParameter.Conflict

The value of parameter SystemDisk.Category and parameter DataDisk.N.Category are conflict.

The error message returned because the specified system disk type conflicts with the data disk type.

400

InvalidRamRole.NotFound

The specified RamRoleName does not exist.

The error message returned because the specified RAM role name does not exist.

400

InvalidScalingConfigurationName.Duplicate

The specified value of parameter ScalingConfigurationName is duplicated.

The error message returned because the scaling configuration name already exists.

404

InvalidScalingGroupId.NotFound

The specified scaling group does not exist.

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

400

InvalidSecurityGroupId.IncorrectNetworkType

The network type of specified security Group does not support this action.

The error message returned because the network types of the specified security group and scaling group are different.

404

InvalidSecurityGroupId.NotFound

The specified security group does not exist.

The error message returned because the specified security group does not exist in the current account.

400

InvalidSecurityGroupId.VPCMismatch

The specified security group and the specified virtual switch are not in the same VPC.

The error message returned because the specified security group and VSwitch are not in the same VPC.

403

InvalidSnapshot.TooOld

This operation is denied because the specified snapshot is created before 2013-07-15.

The error message returned because the snapshot was created on or before July 15, 2013 and the request is rejected.

403

InvalidSystemDiskCategory.ValueUnauthorized

The system disk category is not authorized.

The error message returned because you are not authorized to create an ephemeral disk.

400

InvalidUserData.Base64FormatInvalid

The specified parameter UserData must be base64 encoded.

The error message returned because the specified user data is not encoded in Base64 format.

400

InvalidUserData.SizeExceeded

The specified parameter UserData exceeds the size.

The error message returned because the user data size has exceeded the upper limit.

403

QuotaExceeded.EphemeralDiskSize

Ephemeral disk size quota exceeded.

The error message returned because the total capacity of mounted ephemeral disks has exceeded 2 TiB (2,048 GiB).

400

QuotaExceeded.ScalingConfiguration

Scaling configuration quota exceeded in the specified scaling group.

The error message returned because the maximum number of scaling configurations has been reached.

400

QuotaExceeded.SecurityGroupInstance

Instance quota exceeded in the specified security group.

The error message returned because the maximum number of ECS instances that can be added to the specified security group has been reached.