最近更新时间:2023.07.25 18:39:31
首次发布时间:2021.12.29 11:18:50
调用 ModifyInstanceAttribute 接口修改一台云服务器实例的信息。
调用该接口时,如不传入可选参数,则保持原有配置。
重置密码(Password
)或修改主机名(Hostname
)时需注意:
实例需处于 运行中(RUNNING) 或 已停止(STOPPED) 状态,您可以调用DescribeInstances查询实例的状态。
操作完成后需重启实例使操作生效,您可以在云服务器控制台或者调用RebootInstance或者在操作系统内部重启实例。
关于密码插件:
使用CentOS 6.9/6.10、Ubuntu 14.04创建的实例不支持修改主机名。
名称 | 类型 | 是否必填 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | ModifyInstanceAttribute | 要执行的操作,取值:ModifyInstanceAttribute。 |
Version | String | 是 | 2020-04-01 | API的版本,取值:2020-04-01。 |
InstanceId | String | 是 | i-l8u10sauiu9qj0h***** | 实例ID。 |
Password | String | 否 | password@123 | 使用“密码”方式登录实例时,请设置root登录密码:
|
UserData | String | 否 | - | 实例自定义数据,提供一种自定义实例启动行为及传入数据的功能。
|
InstanceName | String | 否 | instance-test | 实例的名称。
|
Description | String | 否 | 用于测试的云服务器实例 | 实例的描述。
说明 传入空字符串时,将清空原有描述信息。 |
Hostname | String | 否 | instance-host-name | 实例主机名,即实例操作系统内部的计算机名。
|
ClientToken | String | 否 | 333456899ff**** | 保证请求幂等性。由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。 取值:仅支持ASCII字符,且不能超过64个字符。 |
操作接口仅返回公共参数及错误码。
GET /?Action=ModifyInstanceAttribute&Version=2020-04-01&InstanceId=i-l8u10sauiu9qj0h*****&Password=password@123 HTTP/1.1 Host: open.volcengineapi.com Region: cn-beijing Service: ecs
{ "ResponseMetadata": { "RequestId": "20211104180426010194099035220C****", "Action": "ModifyInstanceAttribute", "Version": "2020-04-01", "Service": "ecs", "Region": "cn-beijing" }, "Result": {} }
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | MissingParameter.InstanceId | The required parameter InstanceId is not supplied. | 实例ID不能为空。 |
400 | MissingParameter.InstanceName | The required parameter InstanceName is not supplied. | 实例名称不能为空。 |
400 | InvalidInstanceDescription.Malformed | The specified InstanceDescription is malformed. | 指定的实例描述不合法。 |
400 | InvalidInstanceName.Malformed | The specified InstanceName is malformed. | 指定的实例名称不合法。 |
400 | InvalidUserData.Malformed | The specified UserData is malformed. | 指定的UserData不合法。 |
400 | InvalidPassword.Malformed | The specified password is malformed. | 指定的密码格式不合法。 |
400 | InvalidInstanceStatus | The status of the specified instance does not support this request. | 当前实例的状态不支持此操作。 |
400 | Insufficient.Balance | The request is denied due to the lack of balance. | 账户余额不足。 |
400 | IdempotentParameterMismatch | The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical. | 幂等参数不一致。 |
400 | InvalidClientToken.Malformed | The specified ClientToken is malformed. | 指定的ClientToken不合法。 |
400 | InvalidHostname.Malformed | The specified Hostname is malformed. | 指定的主机名不合法。 |
404 | InvalidInstance.NotFound | The specified instance does not exist. | 指定的实例不存在。 |
404 | InvalidResetAuthenticationAgent.NotFound | The specified reset-authentication agent does not install on the instance. | 指定的密码重置插件不存在。 |
412 | OperationDenied.ResourceCreatedByOtherService | The specified operation is denied as your resource is created by other service. You can check system tags to find the service. | 指定的操作被拒绝,因为您的资源被其他服务创建。您可以通过资源的系统标签查询对应服务。 |
412 | IdempotentProcessing | The request uses the same client token as a previous one that is still in process. | 先前的幂等请求仍在处理中,请稍后重试。 |
500 | InternalError | An internal error has occurred. | 内部错误,请重试。如果多次尝试失败,请提交工单。 |