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 in the server group that you want to create or the server group for which you want to add or remove servers. Separate multiple UUIDs with commas (,).

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

The name of the server group that 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 55426

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

Note To modify the mapping between an asset and an asset group, you must provide the ID of the asset group. You can call the DescribeAllGroups operation to query the IDs of asset groups. If you do not specify this parameter when you call this operation, an asset 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 servers to or remove servers from a server group:

  • Create a server group: You do not need to specify GroupId but must specify GroupName. The Uuids parameter is optional.
  • Add servers to or remove servers from a server group: You must specify both 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, which is used to locate and troubleshoot issues.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateOrUpdateAssetGroup
&Uuids=aq12-***,s23***
&GroupName=test
&GroupId=55426
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HTTP status code Error code Error message Description
400 GroupNameRepeated group name repeated The error message returned because the name of the server group already exists.
500 ServerError ServerError The error message returned because a server error occurred.

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