Adds one or more hosts to a host group.
Usage notes
You can call this operation to add one or more hosts to a host group. You can add multiple hosts to a host group to manage and grant permissions on the hosts in a centralized manner.
QPS limit
You can call this operation up to 10 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | AddHostsToGroup |
The operation that you want to perform. Set the value to AddHostsToGroup. |
HostGroupId | String | Yes | 1 |
The ID of the host group to which you want to add hosts. Note You can call the ListHostGroups operation to query the ID of the host group.
|
HostIds | String | Yes | ["1","2","3"] |
The ID of the host that you want to add to the host group. The value is a JSON string. You can add up to 100 host IDs. Note You can call the ListHosts operation to query the IDs of hosts.
|
InstanceId | String | Yes | bastionhost-cn-st220aw**** |
The ID of the bastion host for which you want to add hosts to the host group. Note You can call the DescribeInstances operation to query the ID of the bastion host.
|
RegionId | String | No | cn-hangzhou |
The region ID of the bastion host for which you want to add hosts to the host group. Note For more information about the mapping between region IDs and region names, see Regions and zones.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 81500666-d7f5-4143-8329-0223cc738105 |
The ID of the request. |
Results | Array of Item |
The result of the call. |
|
Code | String | OK |
The return code that indicates whether the call was successful. Valid values:
|
HostGroupId | String | 1 |
The ID of the host group. |
HostId | String | 1 |
The ID of the host. |
Message | String | None |
This parameter is deprecated. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=AddHostsToGroup
&HostGroupId=1
&HostIds=["1","2","3"]
&InstanceId=bastionhost-cn-st220aw****
&<Common request parameters>
Sample success responses
XML
format
<AddHostsToGroupResponse>
<RequestId>81500666-d7f5-4143-8329-0223cc738105</RequestId>
<Results>
<HostGroupId>1</HostGroupId>
<HostId>1</HostId>
<Code>OK</Code>
</Results>
</AddHostsToGroupResponse>
JSON
format
{
"RequestId": "81500666-d7f5-4143-8329-0223cc738105",
"Results": {
"HostGroupId": "1",
"Message": "",
"HostId": "1",
"Code": "OK"
}
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
500 | InternalError | An unknown error occurred. | The error message returned because an unknown error occurred. |
400 | InvalidParameter | The argument is invalid. | The error message returned because one or more parameters are invalid. |
For a list of error codes, visit the API Error Center.