Creates a server group or adds servers to or removes servers from a server group.

A server can belong only to one server group. If you call the CreateOrUpdateAssetGroup operation and the server specified in request parameters belongs to Server Group A, the server is removed from Server Group A and then added to the newly created or specified server group after the call is complete.

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
Action String Yes CreateOrUpdateAssetGroup

The operation that you want to perform.

Set the value to CreateOrUpdateAssetGroup.

Uuids String No aq12-***,s23***

The UUID of the server that belongs to the server group.

Note You can call the DescribeCloudCenterInstances operation to query the UUIDs of servers.
GroupName String No test

The name of the server group you want to create or the server group for which you want to add or remove a server.

Note To modify the mapping between a server and a server group, you must provide the name of the server group. You can call the DescribeAllGroups operation to query the names of server groups. If you do not specify GroupID when you call this operation, a server group is created. In this case, you must specify GroupName.
GroupId Long No 111111

The ID of the server group for which you want to add or remove servers.

Note To modify the mapping between a server and a server group, you must provide the ID of the server group. You can call the DescribeAllGroups operation to query the IDs of server groups. If you do not specify this parameter when you call this operation, a server group is created.

The following list describes the difference in the configurations of request parameters when you call the CreateOrUpdateAssetGroup operation to create a server group and add or remove servers for a server group:

  • Create a server group: You do not need to specify GroupId but must specify GroupName. The Uuids parameter is optional.
  • Add or remove servers for a server group: You must specify GroupId and Uuids. The GroupName parameter is optional.

All Alibaba Cloud API operations must include common request parameters. For more information about common request parameters, see Common parameters.

For more information about sample requests, see the "Examples" section of this topic.

Response parameters

Parameter Type Example Description
GroupId Long 9935302

The ID of the server group.

RequestId String E70074C8-DFB4-44C5-96C7-909DD231D68A

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateOrUpdateAssetGroup
&GroupName=test
&<Common request parameters>

Sample success responses

XML format

<CreateOrUpdateAssetGroupResponse>
      <RequestId>E70074C8-DFB4-44C5-96C7-909DD231D68A</RequestId>
      <GroupId>9935302</GroupId>
</CreateOrUpdateAssetGroupResponse>

JSON format

{
	"RequestId": "E70074C8-DFB4-44C5-96C7-909DD231D68A",
	"GroupId": 9935302
}

Error codes

For a list of error codes, visit the API Error Center.