The 201 status code and the cluster ID are returned:
POST /clusters?IdempotentToken={IdempotentToken}
{
"Name": "test-ubuntu",
"Description": "demo",
"ImageId": "m-2309yqb5n",
"InstanceType": "bcs.a2.large",
"UserData": {
"key1": "value1"
},
"Notification": {
"Topic": {
"Name": "test-topic",
"Endpoint": "http://[UserId].mns.[Region].aliyuncs.com/",
"Events": [
"OnClusterDeleted",
"OnInstanceCreated",
"OnInstanceActive"
]
}
},
"Configs": {
"Disks": {
"SystemDisk": {
"Type": "cloud",
"Size": 500
},
"DataDisk": {
"Type": "cloud",
"Size": 500,
"MountPoint": "/path/to/mount"
}
},
"Mounts": {
"Entries": [
{
"Destination": "/home/admin/mount-dest",
"Source": "oss://your-bucket/mount-source",
"WriteSupport": true
}
],
"Locale": "GBK",
"Lock": false,
"CacheSupport": true,
"NAS": {
"AccessGroup": [
"group1",
"group2"
],
"FileSystem": [
"filesystem1",
"filesystem2"
]
},
"OSS": {
"AccessKeyId": "",
"AccessKeySecret": "",
"AccessSecurityToken": ""
}
},
"Networks": {
"Classic": {
"AllowIpAddress": [],
"AllowIpAddressEgress": [],
"AllowSecurityGroup": [],
"AllowSecurityGroupEgress": []
},
"VPC": {
"CidrBlock": "10.0.0.0/8"
}
}
},
"Groups": {
"group1": {
"DesiredVMCount": 3,
"InstanceType": "",
"ResourceType": "OnDemand",
"SpotStrategy": "SpotAsPriceGo",
"SpotPriceLimit": 0.0
}
}
}Attribute description
Attribute | Type | Required | Description |
Name | String | Yes | Cluster name. |
ImageId | String | Yes | Image ID. |
InstanceType | string | Yes | Type of an instance for setting up a cluster. |
Groups | object | Yes | Information about instance groups in the cluster. |
Description | string | No | Description of the cluster. |
UserData | object | No | Key-Value mapping. It is user-defined and can be obtained by using metaserver of the ECS. |
Notification | object | No | Notification message configuration. |
Configs | object | No | Cluster configurations, such as the disk configuration of the instance. |
IdempotentToken | String | No | Idempotence used to guarantee the request. The value is generated by a client. It must be unique among all requests and can contain a maximum of 64 characters, including letters, numbers, and underscores. |
Response
Success
{
"Id":"usr-cluster-1"
}Attribute description
Attribute | Type | Description |
Id | String | Job ID. |
Error codes
Error code | Error message | Status code | Syntax |
IdempotentTokenMismatch | Specified idempotent token mismatch. | 400 | The token has been used and different from that in the previous request. |
InvalidJsonFormat | The request body has an invalid json format. | 400 | The request body has an invalid JSON format. |
InvalidHttpBody | Specified parameter HttpBody is not valid. Its type must be object. | 400 | Http Body must be an object. |
MissingName | Name is mandatory for this action. | 400 | The parameter Name is missing. |
MissingConfigs.Networks.VPC.OppositeRouterId | Configs.Networks.VPC.OppositeRouterId is mandatory for this action. | 400 | The parameter Configs.Networks.VPC.OppositeRouterId is missing. |
MissingConfigs.Networks.VPC.OppositeAccessPointId | Configs.Networks.VPC.OppositeAccessPointId is mandatory for this action. | 400 | The parameter Configs.Networks.VPC.OppositeAccessPointId is missing. |
MissingConfigs.Networks.VPC.OppositeRegionId | Configs.Networks.VPC.OppositeRegionId is mandatory for this action. | 400 | The parameter Configs.Networks.VPC.OppositeRegionId is missing. |
InvalidName | Specified parameter Name is not valid. Its type must be string. | 400 | Name must be a string. |
InvalidName | Specified parameter Name is not valid. Its length must be in [1, 64]. | 400 | The length of Name must be in the range of [1, 64]. |
InvalidName | Specified parameter Name is not valid. It must only contain characters within [a-zA-Z0-9_-], and must not start with [0-9]. | 400 | Name can contain only letters, numbers, underscores, and hyphens, and cannot start with a number. |
InvalidDescription | Specified parameter Description is not valid. Its type must be string. | 400 | Description must be a string. |
InvalidDescription | Specified parameter Description is not valid. Its length must be in [0, 1024]. | 400 | The length of Description must be in the range of [0, 1024]. |
MissingImageId | ImageId is mandatory for this action. | 400 | The parameter ImageId is missing. |
InvalidImageId | Specified parameter ImageId is not valid. Its type must be string. | 400 | ImageId must be a string. |
InvalidImageId | Specified parameter ImageId is not valid. Its length must be in [1, 256]. | 400 | The ImageId length must be in the range of [1, 256]. |
InvalidUserData | Specified parameter UserData is not valid. Its type must be object. | 400 | UserData must be an object. |
InvalidUserData | Specified parameter UserData is not valid. Its size must be in [0, 64]. | 400 | The UserData size must be in the range of [0, 64]. |
InvalidUserData.{key} | Specified parameter UserData.{key} is not valid. Its length must be in [1, 128]. | 400 | The size of UserData.{key} must be in the range of [1, 128]. |
InvalidUserData.{key}.value | Specified parameter UserData.{key}.value is not valid. Its type must be string. | 400 | The value of UserData.{key} must be a string. |
InvalidUserData.{key}.value | Specified parameter UserData.{key}.value is not valid. Its length must be in [0, 1024]. | 400 | The length of UserData.{key} must be in the range of [0, 1024]. |
InvalidGroups | Specified parameter Groups is not valid. Its type must be object. | 400 | Groups must be an object. |
InvalidGroups.{key} | Specified parameter Groups.{key} is not valid. Its type must be object. | 400 | Groups.{key} must be an object. |
InvalidGroups.{key} | Specified parameter Groups.{key} is not valid. Its size must be in [1, 64]. | 400 | The value of Groups.{key} must be in the range of [1, 64]. |
MissingDesiredVMCount | DesiredVMCount is mandatory for this action. | 400 | The parameter DesiredVMCount is missing. |
InvalidDesiredVMCount | Specified parameter DesiredVMCount is not valid. Its type must be integer. | 400 | DesiredVMCount must be an integer. |
InvalidDesiredVMCount | Specified parameter DesiredVMCount is not valid. It must be in [1, 65536]. | 400 | The value of DesiredVMCount must be in the range of [1, 65536]. |
InvalidCidrBlock | Specified parameter CidrBlock is not valid. Configs.Networks.VPC.CidrBlock is not valid. | 400 | The CIDRBlock is invalid. |
QuotaExhausted.MaxClusterCount | The MaxClusterCount ({value}) quota is exhausted. | 403 | The number of clusters cannot exceed {value}. |
QuotaExhausted.MaxClusterGroupCount | The MaxClusterGroupCount ({value}) quota is exhausted. | 403 | The number of groups in a cluster cannot exceed {value}. |
QuotaExhausted.MaxClusterGroupDesiredVMCount | The MaxClusterGroupDesiredVMCount ({value}) quota is exhausted. | 403 | DesiredVMCount of a group in a cluster cannot exceed {value}. |
QuotaExhausted.Configs.Networks.VPC.OppositeRouterType | The Configs.Networks.VPC.OppositeRouterType ({value}) is forbidden. | 403 | The value of Configs.Networks.VPC.OppositeRouterType cannot be {value}. |
MissingInstanceType | InstanceType is mandatory for this action. | 400 | The parameter InstanceType is missing. |
InvalidInstanceType | Specified parameter InstanceType is not valid. | 400 | The value of InstanceType is invalid. |
MissingResourceType | ResourceType is mandatory for this action. | 400 | The parameter ResourceType is missing. |
InvalidResourceType | Specified parameter ResourceType is not valid. | 400 | The value of ResourceType is invalid. |
Invalid{Parameter} | Specified parameter {Parameter} is not valid. | 400 | The {Parameter} parameter is invalid. |