Creating an AS Configuration
Function
This API is used to create an AS configuration.
- An AS configuration is a template specifying specifications for the instances to be added to an AS group.
- The AS configuration is decoupled from the AS group. An AS configuration can be used by multiple AS groups.
- Up to 100 AS configurations can be created for each user.
Authorization
Each account has all of the permissions required to call all APIs, but IAM users must have the required permissions specifically assigned.
- If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
- If you are using identity policy-based authorization, the permission listed below is required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
as:scalingConfig:create
write
-
as:configs:create
-
URI
POST /autoscaling-api/v1/{project_id}/scaling_configuration
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Specifies the project ID. For details, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
Request
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| scaling_configuration_name | No | String | Definition Specifies the AS configuration name. Constraints N/A Range The value can contain 1 to 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. Default Value N/A |
| instance_config | No | Object | Definition Specifies the ECS configuration. For details, see Table 3. Constraints N/A |
| source_scaling_configuration_id | No | String | Definition Specifies the ID of the source AS configuration, which will be used together with instance_config to create a new AS configuration. You can obtain the ID by calling the Querying AS Configurations API. Constraints
Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| instance_id | No | String | Definition Specifies the ECS ID. You can obtain the value by calling the Listing ECSs API. Constraints
Range N/A Default Value N/A |
| flavorRef | No | String | Definition Specifies the ECS flavor ID. You can obtain an ECS flavor ID from the API for querying details about flavors and extended flavor information. For details, see Querying Details About Flavors and Extended Flavor Information. Constraints A maximum of 10 flavors can be selected. Use commas (,) to separate multiple flavor IDs. Range N/A Default Value N/A |
| imageRef | No | String | Definition Specifies the image ID. Its value is the same as that of image_id for specifying the image selected during ECS creation. You can obtain an image ID by calling the IMS API for querying images. For details, see Querying Images. Constraints N/A Range N/A Default Value N/A |
| disk | No | Array of disk objects | Definition Specifies the disk group information. For details, see Table 4. Constraints The system disk is mandatory, and data disks are optional. |
| key_name | No | String | Definition Specifies the name of the SSH key pair used to log in to the ECS. For details about how to obtain a key pair, see Creating and Importing an SSH Key Pair. Constraints If both key_name and user_data are specified, user_data only injects user data. Range N/A Default Value N/A |
| personality | No | Array of personality objects | Definition Specifies information about the injected file. For details, see Table 6. Constraints Only text files can be injected. A maximum of five files can be injected, and the maximum size of each file is 1 KB. |
| public_ip | No | public_ip object | Definition Specifies the EIP of the ECS. The EIP can be configured in two ways. For details, see Table 7. Constraints There are two ways to configure an EIP:
If you enable fine-grained policy and associate the AS configuration with an EIP specified to an AS group, the fine-grained policy granted to you must contain the authorization item that allows the vpc:publicIps:create action. |
| user_data | No | String | Definition Specifies the user data to be injected during the ECS creation process. Text, text files, and gzip files can be injected. For more information, see Passing User Data to ECSs. Constraints
Range The password must:
Examples:
In the preceding command output, $6$V6azyeLwcD3CHlpY$BN3VVq18fmCkj66B4zdHLWevqcxlig is the ciphertext password, which can be generated as follows: 1. Generate an encrypted salt value. [root@test linux]# python -c "import crypt, getpass, pwd;print crypt.mksalt()" $6$V6azyeLwcD3CHlpY 2. Generate a ciphertext password based on the salt value. [root@test linux]# python -c "import crypt, getpass, pwd;print crypt.crypt('Cloud.1234','\$6\$V6azyeLwcD3CHlpY')" $6$V6azyeLwcD3CHlpY$BN3VVq18fmCkj66B4zdHLWevqcxlig Examples:
Default Value N/A |
| metadata | No | metadata object | Definition Specifies the ECS metadata. For details, see Table 10. Constraints
|
| security_groups | No | Array of security_groups objects | Definition Specifies security groups. For details, see Table 11. For how to obtain information about security groups using VPC IDs, see Querying Security Groups in Virtual Private Cloud API Reference. Constraints If a security group is specified both in the AS configuration and AS group, scaled ECS instances will be added to the security group specified in the AS configuration. If a security group is not specified in either of them, scaled ECS instances will be added to the default security group. For your convenience, you are advised to specify a security group in the AS configuration. |
| server_group_id | No | String | Definition Specifies the ECS group ID. For how to obtain an ECS group ID, see Listing ECS Groups. Constraints N/A Range N/A Default Value N/A |
| tenancy | No | String | Definition Specifies that ECSs are created on DeHs. Constraints Spot instances cannot be created on DeHs. Range
Default Value N/A |
| dedicated_host_id | No | String | Definition Specifies the ID of a DeH. You can obtain the value by calling the Querying DeHs API. Constraints
Range N/A Default Value N/A |
| multi_flavor_priority_policy | No | String | Definition Specifies the priority policy for selecting a flavor when using an AS configuration to create ECSs. Constraints N/A Range
Default Value PICK_FIRST |
| market_type | No | String | Definition Specifies the ECS billing mode, which can be spot pricing or pay-per-use. Constraints N/A Range
Default Value null |
| cpu_options | No | CpuOptions object | Definition Specifies whether to disable hyper-threading for instances. For details, see Table 12. Constraints N/A |
For a Linux ECS, its password can be injected only using userdata. For a Windows ECS, its password can be injected using metadata or admin_pass of instance_metadata.
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| size | Yes | Integer | Definition Specifies the disk size. The unit is GB. Constraints The system disk size must be no less than the minimum size (min_disk) of the system disk specified in the image. Range
Default Value N/A |
| volume_type | Yes | String | Definition Specifies the ECS system disk type. The disk type must be one of the types available in the system. For details about disk types, see Disk Types and Performance. Constraints If the specified disk type is not available in the AZ specified by availability_zone, the disk creation will fail. Range The value can be SATA, SAS, GPSSD, SSD, GPSSD2, ESSD2, and ESSD.
NOTE: Different ECS flavors support different disk types. The supported disk types will be displayed on the management console. Default Value N/A |
| disk_type | Yes | String | Definition Specifies the disk type (system disk or data disk). Constraints System disks cannot be encrypted. Range
Default Value N/A |
| dedicated_storage_id | No | String | Definition Specifies the ID of the DSS device for creating an ECS disk. You can obtain the value by calling the Obtaining Details of DSS Storage Pools API. Constraints Specify DSS devices for all disks in an AS configuration or not. If DSS devices are specified, all the data stores must belong to the same AZ, and the disk types supported by a DSS device for a disk must be the same as the volume_type value. Range N/A Default Value N/A |
| data_disk_image_id | No | String | Definition Specifies the ID of a data disk image used to export data disks of an ECS. You can obtain the value by calling the Querying Images API. Constraints The data disk image type must be the same as the image type specified in the AS configuration. Range N/A Default Value N/A |
| snapshot_id | No | String | Definition Specifies the disk backup snapshot ID for restoring the system disk and data disks using a full-ECS backup when a full-ECS image is used. You can obtain the disk backup snapshot ID by calling the Querying a Single Backup API based on the full-ECS backup ID. Constraints Each disk in an AS configuration must correspond to a disk backup in the full-ECS backup by snapshot_id. Range N/A Default Value N/A |
| metadata | No | metadata object | Definition Specifies the metadata for creating disks. For details, see Table 5. Constraints N/A |
| iops | No | Integer | Definition Specifies the number of input/output operations per second (IOPS) for a disk.
Constraints
Range
Default Value N/A |
| throughput | No | Integer | Definition Specifies the throughput of an EVS disk. The unit is MiB/s. This parameter is mandatory when volume_type is set to GPSSD2 and cannot be configured when volume_type is set to other values. For details about the throughput range of GPSSD2 EVS disks, see Disk Types and Performance. Constraints
Range 125–1,000 Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| __system__encrypted | No | String | Definition Specifies whether disks are encrypted. Constraints System disks cannot be encrypted. If this parameter is absent, disks are not encrypted by default. Range
Default Value 0 |
| __system__cmkid | No | String | Definition Specifies the CMK ID used for encryption. For details about how to use an HTTPS request to obtain the CMK ID, see Querying the Key List. Constraints
Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| path | Yes | String | Definition Specifies the path of the injected file. Constraints N/A Range
Default Value N/A |
| content | Yes | String | Definition Specifies the content of the injected file. The value must be the information after the content of the injected file is encoded using Base64. Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| eip | Yes | eip object | Definition Specifies the EIP automatically assigned to the ECS. For details, see Table 8. Constraints N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| ip_type | Yes | String | Definition Specifies the EIP type. For details, see the publicip field in Assigning an EIP in Virtual Private Cloud API Reference. Constraints N/A Range
Default Value N/A |
| bandwidth | Yes | bandwidth object | Definition Specifies the bandwidth of an IP address. For details, see Table 9. Constraints N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| size | No | Integer | Definition Specifies the bandwidth size. Constraints
Range [1,2000] Mbit/s for bandwidth billing, [1,300] Mbit/s for traffic billing Default Value N/A |
| share_type | Yes | String | Definition Specifies the bandwidth sharing type. Constraints N/A Range
Default Value N/A |
| charging_mode | No | String | Definition Specifies the bandwidth billing mode. Constraints
Range
Default Value N/A |
| id | No | String | Definition Specifies the bandwidth ID. When using a shared bandwidth, you can select an existing shared bandwidth to create an EIP. For details, see Querying Bandwidths. Constraints
Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| admin_pass | No | String | Definition Specifies the initial login password of the administrator account for logging in to an ECS using password authentication. Constraints The Linux administrator is root, and the Windows administrator is Administrator. Range The password must:
Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | Yes | String | Definition Specifies the ID of the security group. For details about how to obtain a security group ID, see Viewing the Details of a Security Group. Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| hw_cpu_threads | No | Integer | Definition Specifies the number of CPU hyperthreads, which determines whether to enable CPU hyper-threading. Constraints N/A Range
Default Value 2 |
Example Request
POST https://{Endpoint}/autoscaling-api/v1/{project_id}/scaling_configuration
{
"scaling_configuration_name": "as-config-tlzp",
"instance_config": {
"flavorRef": "s3.xlarge.4",
"imageRef": "627a1223-2ca3-46a7-8d5f-7aef22c74ee6",
"disk": [
{
"size": 40,
"volume_type": "SATA",
"disk_type": "SYS"
}
],
"key_name": "100vm_key" ,
"security_groups": [{
"id": "6c22a6c0-b5d2-4a84-ac56-51090dcc33be"
}],
"multi_flavor_priority_policy": "PICK_FIRST"
}
}
Response
| Parameter | Type | Description |
|---|---|---|
| scaling_configuration_id | String | Definition Specifies the AS configuration ID. For details, see Querying AS Configurations. Range N/A |
Example Response
{
"scaling_configuration_id": "f8327883-6a07-4497-9a61-68c03e8e72a2"
} Returned Values
- Normal
- Abnormal
Returned Value
Description
400 Bad Request
The server failed to process the request.
401 Unauthorized
You must enter the username and password to access the requested page.
403 Forbidden
You are forbidden to access the requested page.
404 Not Found
The server cannot find the requested page.
405 Method Not Allowed
You are not allowed to use the method specified in the request.
406 Not Acceptable
The client does not accept the response generated by the server.
407 Proxy Authentication Required
The client must be authorized by the proxy before the request can proceed.
408 Request Timeout
The request timed out.
409 Conflict
The request cannot be processed due to a conflict.
500 Internal Server Error
Failed to complete the request because of an internal service error.
501 Not Implemented
Failed to complete the request because the server does not support the requested function.
502 Bad Gateway
Failed to complete the request because the request is invalid.
503 Service Unavailable
Failed to complete the request because the system is unavailable.
504 Gateway Timeout
The gateway timed out.
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot