You need to enable JavaScript to run this app.
导航
ModifyInstanceAttribute - 修改实例信息
最近更新时间:2024.10.28 17:36:25首次发布时间:2021.12.29 11:18:50
我的收藏
有用
有用
无用
无用

调用 ModifyInstanceAttribute 接口修改一台ECS实例的信息,包括名称、描述、密码、主机名以及自定义数据等。

使用说明

修改实例的登录密码、主机名、自定义数据之前,请务必先查看相关文档,充分了解其中的约束限制和注意事项,以确保操作的准确性和合规性。

请求说明

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

调试

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

参数
类型
是否必填
示例值
描述
Action
String

ModifyInstanceAttribute

要执行的操作,取值:ModifyInstanceAttribute。

Version
String

2020-04-01

API的版本,取值:2020-04-01。

ClientToken
String

333456899ff****

保证请求幂等性。由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。
取值:仅支持ASCII字符,且不能超过64个字符。

Description
String

用于测试的云服务器实例

实例的描述。

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

说明

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

Hostname
String

instance-host-name

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

  • Linux实例:
    • 允许使用字母、数字、点号“.”或中划线“-”。
    • 不能以中划线、点号开头或结尾,且不能连续使用中划线和点号。
    • Linux系统长度限制在2~63个字符之间。
  • Windows实例:
    • 允许使用字母、数字或中划线“-”,不能完全是数字。
    • 不能以中划线开头或结尾,且不能连续使用中划线。
    • Windows系统长度限制在2~15个字符之间。
InstanceId
String

i-l8u10sauiu9qj0h*****

实例ID。

InstanceName
String

instance-test

实例的名称。

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

password@123

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

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

IyEvYmluL2Jhc2gKdG91Y2ggL3RtcC91c2VyZG******

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

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

返回参数

本接口无特有的返回参数。更多信息请见返回结构

请求示例

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": {}
}

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

状态码
错误码
错误信息
说明
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
Insufficient.Balance
The request is denied due to the lack of balance.

账户余额不足。

400
InvalidClientToken.Malformed
The specified ClientToken is malformed.

指定的ClientToken不合法。

400
InvalidDedicatedHostStatus.Unsupported
The status of the specified dedicated host does not support this request.

当前专有宿主机的状态不支持此操作。

400
InvalidHostname.Malformed
The specified Hostname is malformed.

指定的主机名不合法。

400
InvalidInstanceDescription.Malformed
The specified InstanceDescription is malformed.

指定的实例描述不合法。

400
InvalidInstanceName.Malformed
The specified InstanceName is malformed.

指定的实例名称不合法。

400
InvalidInstanceStatus
The status of the specified instance does not support this request.

当前实例的状态不支持此操作。

400
InvalidPassword.Malformed
The specified password is malformed.

指定的密码格式不合法。

400
InvalidUserData.Malformed
The specified UserData is malformed.

指定的UserData不合法。

400
MissingParameter.InstanceId
The required parameter InstanceId is not supplied.

参数实例ID不能为空。

400
MissingParameter.InstanceName
The required parameter InstanceName is not supplied.

实例名称不能为空。

403
InvalidInstance.RequestForbidden
Request is forbidden by the server.

由于您的火山引擎账户违反了相关规定,指定的资源已不再可以使用,如需恢复服务请提交工单联系服务人员处理。

404
InvalidInstance.NotFound
The specified instance does not exist.

指定的实例不存在。

404
InvalidResetAuthenticationAgent.NotFound
The specified reset-authentication agent does not install on the instance.

指定的密码重置插件不存在。

412
IdempotentProcessing
The request uses the same client token as a previous one that is still in process.

先前的幂等请求仍在处理中,请稍后重试。

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.

指定的操作被拒绝,因为您的资源被其他服务创建。您可以通过资源的系统标签查询对应服务。

500
InternalError
An internal error has occurred.

内部错误,请重试。如果多次尝试失败,请提交工单。