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

ReplaceSystemVolume

最近更新时间2023.12.19 17:36:50

首次发布时间2022.04.01 11:40:15

调用 ReplaceSystemVolume 接口为一台ECS实例更换系统。

说明

  • 请确认相关实例处于 已停止 状态,否则更换系统后可能丢失正在写入的数据,您可参考 StopInstance 接口完成停止操作。
  • Linux更换为Windows操作系统后,主机名默认保留前15位。

调试

请求参数

名称类型是否必选示例值描述
ActionStringReplaceSystemVolume要执行的操作,取值:ReplaceSystemVolume。
VersionString2020-04-01接口的版本,取值:2020-04-01。
InstanceIdStringi-a8j6n1i4hojfqpa0****实例ID。您可以调用DescribeInstances接口查询获取。
ImageIdStringimage-38dfk6rfisf6kir6****更换操作系统时使用的镜像ID。您可以调用DescribeImages接口查询获取。

Password

String

Password@123

重置密码,密码规则如下:

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

说明

  • 登录凭证支持“密码”、“密钥对”、“保留镜像设置”三种方式,使用“密码”方式登录实例时,建议增加密码复杂度以提高安全性。
  • KeepImageCredentialfalse时,本参数与KeyPairName不能同时为空。

KeyPairName

String

kp-test-123

重置密钥对。您可以调用DescribeKeyPairs接口查询获取。

说明

  • 仅对Linux操作系统的实例生效。
  • KeepImageCredentialfalse时,本参数与Password不能同时为空。
  • 若同时设置了密钥对KeyPairName和密码Password,则仅生效密钥对KeyPairName

ClientToken

String

333456899ff****

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

  • 仅支持ASCII字符,且不能超过64个字符。

KeepImageCredential

Boolean

false

使用镜像预设密码/密钥对登录实例。取值:

  • true:使用镜像预设密码/密钥对登录。
  • false(默认):不使用镜像预设密码/密钥对登录。

说明

  • 仅自定义镜像、共享镜像支持使用该功能。
  • 该参数为true时,请勿传入PassWordKeyPairName

DryRun

Boolean

false

是否只预检此次请求。取值:

  • true:发送检查请求,不会更换系统。检查项包括是否填写了必需参数、请求格式、业务限制。如果检查不通过,则返回对应错误。如果检查通过,则返回错误码DryRunOperation
  • false(默认):发送正常请求,通过检查后直接更换系统。

返回数据

操作接口仅返回公共参数及错误码。

请求示例

GET /?Action=ReplaceSystemVolume&Version=2020-04-01&InstanceId=i-a8j6n1i4hojfqpa0****&ImageId=image-38dfk6rfisf6kir6****&Password=Password@123 HTTP/1.1
Host: open.volcengineapi.com
Region: cn-beijing
Service: ecs

返回示例

{
    "ResponseMetadata": {
            "RequestId": "2021062415303301022514515207C4****",
            "Action": "ReplaceSystemVolume",
            "Version": "2020-04-01",
            "Service": "ecs",
            "Region": "cn-beijing"
    },
    "Result": {}
}

错误码

HttpCode错误码错误信息描述
400MissingParameter.InstanceIdThe required parameter InstanceId is not supplied.实例ID不能为空。
400MissingParameter.PasswordAndKeyPairThe required parameter PasswordAndKeyPair is not supplied.密码与密钥对不允许同时为空。
400InvalidInstanceStatusThe status of the specified instance does not support this request.当前实例的状态不支持此操作。
400MissingParameter.ImageIdThe required parameter ImageId is not supplied.镜像ID不能为空。
400InvalidKeyPairForWindows.UnsupportedThe OSType of this specified instance is Windows, which does not support key pairs.指定的实例是Windows操作系统,不支持密钥对。
400InvalidPassword.MalformedThe specified password is malformed.指定的密码格式不合法。
400InvalidClientToken.MalformedThe specified ClientToken is malformed.指定的ClientToken不合法。
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.幂等参数不一致。
400InvalidArgumentThe specified argument is invalid.指定的参数不合法。
400InvalidVolumeStatusThe status of the specified volume does not support this request.当前实例系统盘状态不支持此操作。
400MissingParameter.VolumeTypeThe required parameter VolumeType is not supplied.云盘类型不能为空。
400LimitExceeded.SystemVolumeSizeThe specified system volume size exceeds the limit.指定的系统盘大小(GiB)超出限制。
404InvalidImage.NotFoundThe specified image does not exist.指定的镜像不存在。
404InvalidKeyPair.NotFoundThe specified KeyPair does not exist.指定的密钥对不存在。
404InvalidInstance.NotFoundThe specified instance does not exist.指定的实例不存在。
412InvalidInstance.ExpiredThe specified instance has expired.实例已过期。
412IdempotentProcessingThe request uses the same client token as a previous one that is still in process.先前的幂等请求仍在处理中,请稍后重试。
412InvalidImage.InstanceTypeMismatchThe specified image and instance type do not match.指定的镜像不支持指定的实例规格。
412InvalidVolumeType.ImageMismatchThe specified VolumeType and Image do not match.指定的云盘类型和镜像不匹配。
412InvalidVolumeSize.ImageSizeMismatchThe specified system disk size is smaller than the image file size.指定系统盘容量小于镜像文件大小。
412OperationDenied.ResourceLockedThe specified operation is denied as your resource is locked for another operation.指定的操作被拒绝,因为您的资源已被其他操作锁定。
412OperationDenied.InstanceIsCreatingImageThe specified operation is denied as your instance is creating image.指定的操作被拒绝,因为您的实例正在创建镜像。
412OperationDenied.ResourceCreatedByOtherServiceThe specified operation is denied as your resource is created by other service. You can check system tags to find the service.指定的操作被拒绝,因为您的资源被其他服务创建,请前往对应服务的控制台操作。
412InvalidImageId.KeepImageCredentialMismatchThe specified ImageId and KeepImageCredential do not match.指定的ImageId和KeepImageCredential不匹配。
412InvalidKeyPairName.KeepImageCredentialMismatchThe specified KeyPairName and KeepImageCredential do not match.指定的KeyPairName和KeepImageCredential不匹配。
412InvalidPassword.KeepImageCredentialMismatchThe specified Password and KeepImageCredential do not match.指定的Password和KeepImageCredential不匹配。
412DryRunOperationYour request has been validated by the DryRunOperation.通过“DryRun”校验,您的请求已通过验证。
412InvalidImage.HostnameMismatchThe hostname of the current instance can not be applied to the image you choose.实例的主机名不适用于您选择的镜像。
500InternalErrorAn internal error has occurred.内部错误,请重试。如果多次尝试失败,请提交工单。