Changes the port for the O&M protocol on one or more hosts.
Usage notes
You can call this operation to change the port for the O&M protocol on one or more hosts. If the standard port for the O&M protocol on your host is vulnerable to attacks, you can call this operation to specify a custom port. For example, the standard port for SSH is port 22.
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 | ModifyHostsPort |
The operation that you want to perform. Set the value to ModifyHostsPort. |
HostIds | String | Yes | ["1","2","3"] |
The ID of the host for which you want to change the port. The value is a JSON string. You can add up to 100 host IDs. If you specify multiple IDs, separate the IDs with commas (,). 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 change the port of the host. Note You can call the DescribeInstances operation to query the ID of the bastion host.
|
Port | String | Yes | 22 |
The new port of the host. The port number must be an integer. Valid values: 22 to 65535. |
ProtocolName | String | Yes | SSH |
The protocol that is used to connect to the host. Valid values:
|
RegionId | String | No | cn-hangzhou |
The region ID of the bastion host for which you want to change the port of the host. Note For more information about the mapping between region IDs and region names, see Regions and zones.
|
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 |
---|---|---|---|
RequestId | String | EC9BF0F4-8983-491A-BC8C-1B4DD94976DE |
The ID of the request, which is used to locate and troubleshoot issues. |
Results | Array of Item |
The result of the call. |
|
Code | String | OK |
The return code that indicates whether the call was successful. Valid values:
|
HostId | String | 1 |
The ID of the host. |
Message | String | None |
This parameter is deprecated. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=ModifyHostsPort
&HostIds=["1","2","3"]
&InstanceId=bastionhost-cn-st220aw****
&Port=22
&ProtocolName=SSH
&<Common request parameters>
Sample success responses
XML
format
<ModifyHostsPortResponse>
<RequestId>EC9BF0F4-8983-491A-BC8C-1B4DD94976DE</RequestId>
<Results>
<Message>None</Message>
<HostId>1</HostId>
<Code>OK</Code>
</Results>
</ModifyHostsPortResponse>
JSON
format
{
"ModifyHostsPortResponse": {
"RequestId": "EC9BF0F4-8983-491A-BC8C-1B4DD94976DE",
"Results": {
"Message":"None",
"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.