All Products
Search
Document Center

CreateCluster

Last Updated: May 14, 2018

Request syntax

  1. POST /clusters?IdempotentToken={IdempotentToken}
  2. {
  3. "Name": "test-ubuntu",
  4. "Description": "demo",
  5. "ImageId": "m-2309yqb5n",
  6. "InstanceType": "bcs.a2.large",
  7. "UserData": {
  8. "key1": "value1"
  9. },
  10. "Notification": {
  11. "Topic": {
  12. "Name": "test-topic",
  13. "Endpoint": "http://[UserId].mns.[Region].aliyuncs.com/",
  14. "Events": [
  15. "OnClusterDeleted",
  16. "OnInstanceCreated",
  17. "OnInstanceActive"
  18. ]
  19. }
  20. },
  21. "Configs": {
  22. "Disks": {
  23. "SystemDisk": {
  24. "Type": "cloud",
  25. "Size": 500
  26. },
  27. "DataDisk": {
  28. "Type": "cloud",
  29. "Size": 500,
  30. "MountPoint": "/path/to/mount"
  31. }
  32. },
  33. "Mounts": {
  34. "Entries": [
  35. {
  36. "Destination": "/home/admin/mount-dest",
  37. "Source": "oss://your-bucket/mount-source",
  38. "WriteSupport": true
  39. }
  40. ],
  41. "Locale": "GBK",
  42. "Lock": false,
  43. "CacheSupport": true,
  44. "NAS": {
  45. "AccessGroup": [
  46. "group1",
  47. "group2"
  48. ],
  49. "FileSystem": [
  50. "filesystem1",
  51. "filesystem2"
  52. ]
  53. },
  54. "OSS": {
  55. "AccessKeyId": "",
  56. "AccessKeySecret": "",
  57. "AccessSecurityToken": ""
  58. }
  59. },
  60. "Networks": {
  61. "Classic": {
  62. "AllowIpAddress": [],
  63. "AllowIpAddressEgress": [],
  64. "AllowSecurityGroup": [],
  65. "AllowSecurityGroupEgress": []
  66. },
  67. "VPC": {
  68. "CidrBlock": "10.0.0.0/8"
  69. }
  70. }
  71. },
  72. "Groups": {
  73. "group1": {
  74. "DesiredVMCount": 3,
  75. "InstanceType": "",
  76. "ResourceType": "OnDemand",
  77. "SpotStrategy": "SpotAsPriceGo",
  78. "SpotPriceLimit": 0.0
  79. }
  80. }
  81. }

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. For more information, see ECS Instance type.
Groups object Yes Information about instance groups in the cluster. The information about each instance group is defined by GroupDesc.
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. You can specify a message event Notification.
Configs object No Cluster configurations, such as the disk configuration of the instance. It is described by Configs.
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

The 201 status code and the cluster ID are returned:

  1. {
  2. "Id":"usr-cluster-1"
  3. }

Attribute description

Attribute Type Description
Id String Job ID.

Error codes

Error code Error message HTTP status code Meaning
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.