You need to enable JavaScript to run this app.
导航

ModifyInstanceAttribute

最近更新时间2023.11.20 10:48:34

首次发布时间2021.12.29 11:18:50

调用 ModifyInstanceAttribute 接口修改一台云服务器实例的信息。

接口说明

  • 调用该接口时,如不传入可选参数,则保持原有配置。

  • 重置密码(Password)或修改主机名(Hostname)时需注意:

    • 实例需处于 运行中(RUNNING)已停止(STOPPED) 状态,您可以调用DescribeInstances查询实例的状态。

    • 操作完成后需重启实例使操作生效,您可以在云服务器控制台或者调用RebootInstance或者在操作系统内部重启实例。

    • 关于密码插件:

      • 重置密码前,请确保实例已安装了密码插件,安装操作请参见安装密码插件

      • 修改主机名前,请确保密码插件已升级至指定版本,具体操作请参见升级密码插件

    • 使用CentOS 6.9/6.10、Ubuntu 14.04创建的实例不支持修改主机名。

调试

请求参数

名称类型是否必填示例值
描述
ActionStringModifyInstanceAttribute要执行的操作,取值:ModifyInstanceAttribute。
VersionString2020-04-01API的版本,取值:2020-04-01。
InstanceIdStringi-l8u10sauiu9qj0h*****实例ID。

Password

String

password@123

使用“密码”方式登录实例时,请设置root登录密码:

  • 长度限制在8~30之间。
  • 密码只能由大写字母、小写字母、数字和特殊字符组成,且必须包含至少三项。
  • 特殊字符可以使用:`~!@#$%^&*()_-+=|{}[]:;'<>,.?/
  • 不能以“/”和“$6$”开头。

UserData

String

-

实例自定义数据,提供一种自定义实例启动行为及传入数据的功能。

  • 传入数据时,设置的自定义数据必须经过Base64编码,且Base64编码前的自定义数据大小不能超过16KB。
  • 传入空字符串时,将清空自定义数据。

InstanceName

String

instance-test

实例的名称。

  • 以字母或中文开头。
  • 只能包含中文、字母、数字、下划线“_”、中划线“-”和点号“.”。
  • 长度限制为1~128个字符。

Description

String

用于测试的云服务器实例

实例的描述。

  • 必须以字母或中文开头。
  • 只能包含中文、字母、数字、点“.”、空格、下划线“_”、中划线“-”、等号“=”、英文逗号“,”、中文逗号“,”和中文句号“。”
  • 长度限制在255个字符以内。

说明

传入空字符串时,将清空原有描述信息。

Hostname

String

instance-host-name

实例主机名,即实例操作系统内部的计算机名。

  • Linux实例:

    • 允许使用字母、数字、点号“.”或中划线“-”。

    • 不能以中划线、点号开头或结尾,且不能连续使用中划线和点号。

    • Linux系统长度限制在2~63个字符之间。

  • Windows实例:

    • 允许使用字母、数字或中划线“-”,不能完全是数字。

    • 不能以中划线开头或结尾,且不能连续使用中划线。

    • Windows系统长度限制在2~15个字符之间。

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错误码错误信息描述
400MissingParameter.InstanceIdThe required parameter InstanceId is not supplied.实例ID不能为空。
400MissingParameter.InstanceNameThe required parameter InstanceName is not supplied.实例名称不能为空。
400InvalidInstanceDescription.MalformedThe specified InstanceDescription is malformed.指定的实例描述不合法。
400InvalidInstanceName.MalformedThe specified InstanceName is malformed.指定的实例名称不合法。
400InvalidUserData.MalformedThe specified UserData is malformed.指定的UserData不合法。
400InvalidPassword.MalformedThe specified password is malformed.指定的密码格式不合法。
400InvalidInstanceStatusThe status of the specified instance does not support this request.当前实例的状态不支持此操作。
400Insufficient.BalanceThe request is denied due to the lack of balance.账户余额不足。
400IdempotentParameterMismatchThe 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.幂等参数不一致。
400InvalidClientToken.MalformedThe specified ClientToken is malformed.指定的ClientToken不合法。
400InvalidHostname.MalformedThe specified Hostname is malformed.指定的主机名不合法。
404InvalidInstance.NotFoundThe specified instance does not exist.指定的实例不存在。
404
InvalidResetAuthenticationAgent.NotFound
The specified reset-authentication agent does not install on the instance.指定的密码重置插件不存在。
412OperationDenied.ResourceCreatedByOtherServiceThe specified operation is denied as your resource is created by other service. You can check system tags to find the service.指定的操作被拒绝,因为您的资源被其他服务创建。您可以通过资源的系统标签查询对应服务。
412IdempotentProcessingThe request uses the same client token as a previous one that is still in process.先前的幂等请求仍在处理中,请稍后重试。
500InternalErrorAn internal error has occurred.内部错误,请重试。如果多次尝试失败,请提交工单。