ReplaceSystemDisk_云服务器 ECS_API文档

插件下载了解更多
VS Code 插件
安装插件之前,确保已安装 VS Code安装插件之前,确保已安装 VS Code
Alibaba Cloud Developer Toolkit is a collection of extensions that can help access Alibaba Cloud services in Visual Studio Code.
JetBrains 插件
安装插件之前,确保已安装 JetBrains IDE安装插件之前,确保已安装 JetBrains IDE
The Alibaba Cloud Developer Toolkit for JetBrains makes it easier to access Alibaba Cloud services.

接口说明

调用该接口前请您仔细阅读更换系统盘(更换操作系统)

更换系统盘时,您需要注意:

  • 不支持变更系统盘计费方式。

  • 不支持更换系统盘的云盘类型。

  • 系统盘挂载的 ECS 实例不能有未支付的订单。

  • 实例的状态必须为已停止(Stopped)状态。

    说明 仅适用于专有网络 VPC 类型实例。如果 ECS 实例为按量付费计费模式,且开启默认启用节省停机模式,为防止地域范围内的 ECS 实例库存不足,引起的更换系统盘后无法重启实例。您需要在停止该实例时设置为普通停机模式。具体操作,请参见 StopInstance
  • ECS 实例不能被安全锁定,即实例的OperationLocks参数值包含"LockReason": "security"。更多信息,请参见安全锁定时的 API 行为

  • 您可以通过参数SystemDisk.Size重新指定系统盘的容量大小。

更换系统盘后,建议您通过以下任一方式验证是否更换成功:

  • 通过 DescribeDisks 接口查询新系统盘的状态。如果已挂载实例,则表示更换系统盘的操作已完成。

  • 通过 DescribeInstances 接口查询更换系统盘的实例的状态。如果返回值OperationLocks为空,则表示更换系统盘的操作已完成。

流控信息

请求速率为200/60(s)。更多流控信息,请前往配额中心查看

授权信息

如下是此API对应的授权信息,用于RAM权限策略语句的Action元素中,为RAM用户或RAM角色授予调用此API的权限。请通过 RAM 访问控制设置,使用方法可参考访问控制帮助文档

具体说明如下:展开详情

操作访问级别资源类型条件关键字关联操作
ecs:ReplaceSystemDisk
Update
Disk
acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}
Image
acs:ecs:{#regionId}:{#accountId}:image/{#imageId}
Instance
acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}
ecs:IsDiskEncrypted
ecs:IsSystemDiskEncrypted
ecs:PasswordInherit
ecs:PasswordCustomized
ecs:IsDiskByokEncrypted
ecs:IsSystemDiskByokEncrypted
ecs:LoginAsNonRoot
ecs:ImagePlatform

请求参数

字段名称字段详情
InstanceIdstring

指定实例的 ID。展开详情

示例值:i-bp67acfmxazb4ph****参考取值来源:
    RunInstances
    StopInstances
    StartInstances
    CreateInstance
    RebootInstances
    DescribeInstances
    ModifyManagedInstance
    RenewReservedInstances
    AttachInstanceRamRole
    DetachInstanceRamRole
    DeregisterManagedInstance
    PurchaseReservedInstancesOffering
ImageIdstring

重置系统时使用的镜像 ID。展开详情

示例值:m-bp67acfmxazb4ph****参考取值来源:
    ImportImage
    CopyImage
    CreateImage
    ExportImage
    DescribeImages
SystemDisk.Sizeinteger<int32>

新的系统盘容量,单位为 GiB。取值范围:展开详情

示例值:80
ClientTokenstring

保证请求幂等性。从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符,且不能超过 64 个字符。更多信息,请参见如何保证幂等性

示例值:123e4567-e89b-12d3-a456-426655440000
UseAdditionalServiceboolean

是否使用阿里云提供的虚拟机系统配置(Windows:NTP、KMS;Linux:NTP、YUM)。展开详情

示例值:true
Passwordstring

是否重置 ECS 实例的用户名密码。长度为 8 至 30 个字符,必须同时包含大小写英文字母、数字和特殊符号中的三类字符。特殊符号可以是:展开详情

示例值:EcsV587!
PasswordInheritboolean

是否使用镜像预设的密码。展开详情

示例值:false
KeyPairNamestring

密钥对名称。 展开详情

示例值:testKeyPairName参考取值来源:
    DetachKeyPair
    CreateKeyPair
    ImportKeyPair
    AttachKeyPair
    DescribeKeyPairs
DiskIdstring
说明 该参数已废弃,为提高兼容性,建议您使用 ImageId
示例值:d-bp67acfmxazb4ph****参考取值来源:
    CreateDisk
    DescribeDisks
Platformstring
说明 已弃用。
示例值:CentOS
Architecturestring
说明 已弃用。
示例值:i386
SecurityEnhancementStrategystring

更换系统盘后,是否免费使用云安全中心服务。取值范围: 展开详情

示例值:Active
Encryptedboolean

是否加密云盘。取值范围:展开详情

示例值:false
KMSKeyIdstring

系统盘对应的 KMS 密钥 ID。

示例值:e522b26d-abf6-4e0d-b5da-04b7******3c参考取值来源:
    DescribeDiskDefaultKMSKeyId
字符长度 <= 64
EncryptAlgorithmstring
说明 该参数暂未开放使用。
示例值:hide
Arnarray<object>

该参数暂未开放使用。

子级条数 <= 10

返回参数

字段名称字段详情
DiskIdstring

新系统盘的云盘 ID。

示例值:d-bp67acfmxazb4ph****
RequestIdstring

请求 ID。

示例值:473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

返回示例

错误返回示例

错误码

全局错误码
HTTP 状态码错误码错误信息操作
400
LoginAsNonRoot.ImageNotSupport
The specified image does not support login as non-root.诊断
400
InvalidSystemDiskSize.ValueNotSupported
The specified parameter SystemDisk.Size is invalid.诊断
400
InvalidParameter.Conflict
The specified image does not support the specified instance type.诊断
400
InvalidSystemDiskSize.ImageNotSupportResize
The specified image does not support resize.诊断
400
InvalidSystemDiskSize
The specified parameter SystemDisk.Size is invalid.诊断
400
InvalidPassword.Malformed
The specified parameter "Password" is not valid.诊断
400
InvalidPasswordParam.Mismatch
The input password should be null when passwdInherit is true.诊断
400
OperationDenied
The specified image contains the snapshot of the data disk,does not support this operation.诊断
400
InvalidDiskCategory.ValueNotSupported
The specified parameter "DiskCategory" is not valid.诊断
400
InvalidKeyPairName.NotFound
The specified KeyPairName does not exist.诊断
400
DependencyViolation.IoOptimize
The specified parameter InstanceId is not valid.诊断
400
MissingParameter.Architecture
Architecture should not be null.诊断
400
InvalidArchitecture.Malformed
Architecture is not valid.诊断
400
MissingParameter.Platform
Platform should not be null.诊断
400
InvalidPlatform.Malformed
Platform is not valid.诊断
400
InvalidDiskId.NotFound
The specified disk do not exist.诊断
400
InvalidDatadisk.DiskStatusViolation
The operation is not permitted due to status of the Datadisk.诊断
400
InvalidDatadisk.DiskCategoryViolation
The operation is not permitted due to category of the Datadisk.诊断
400
InvalidDatadisk.ChargeTypeViolation
The operation is not permitted due to charge type of the Datadisk.诊断
400
MissingParameter
The input parameter "ImageId" that is mandatory for processing this request is not supplied.诊断
400
InvalidInstance.NotFoundSystemDisk
The specified instance has no system disk.诊断
400
InvalidParameter.DiskType
The specified disk type which has kms key can't convert to system disk.诊断
400
DISK_IN_DEDICATED_BLOCK_STORAGE_CLUSTER
The disk in dedicated block storage cluster is not allowed to do this operation.诊断
400
IncorrectDiskStatus.ReplicationStatusNotFound
Disk replication status not found.诊断
400
IncorrectDiskStatus.InReplication
Disk already in replication.诊断
400
InvalidInstanceType.NotSupported
The specified instanceType is not supported by the image architecture.诊断
400
InvalidRegionId.NotSupportReplaceEncryptedSystemDisk
The specified region not support replace encrypted system disk.诊断
400
InvalidStorageClusterId.CapacityNotEnough
The remaining capacity of the current dedicated storage cluster is less than the size of disk.诊断
400
QuotaExceed.DiskCapacity
The used capacity of disk type has exceeded the quota in the zone, %s.诊断
400
AccountForbidden.ProductCreationLimited
The commodity must be officially operated by Aliyun and in pay-as-you-go billing method.诊断
400
InternalError
The requested services is not available now. Please try again later.诊断
403
LoginAsNonRoot.RegionNotSupport
The specified region does not support login as non-root.诊断
403
InvalidSystemDiskStatus.IsTransfering
The current status of the resource does not support this operation, system disk is transfering.诊断
403
IncorrectDiskStatus
The current disk status does not support this operation.诊断
403
IncorrectInstanceStatus
The current status of the resource does not support this operation.诊断
403
InstanceLockedForSecurity
The instance is locked due to security.诊断
403
ImageNotSubscribed
The specified image has not be subscribed.诊断
403
ImageRemovedInMarket
The specified market image is not available, Or the specified user defined image includes product code because it is based on an image subscribed from marketplace, and that image in marketplace includeing exact the same product code has been removed.诊断
403
InstanceExpiredOrInArrears
The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).诊断
403
ChargeTypeViolation
The operation is not permitted due to charge type of the instance.诊断
403
DiskCreatingSnapshot
The operation is denied due to a snapshot of the specified disk is not completed yet.诊断
403
IoOptimized.NotSupported
The specified image is not support IoOptimized Instance.诊断
403
ImageNotSupportInstanceType
The specified image don not support the InstanceType instance.诊断
403
QuotaExceed.BuyImage
The specified image is from the image market,You have not bought it or your quota has been exceeded.诊断
403
INST_HAS_UNPAID_ORDER
The instance has unpaid order.诊断
403
OperationDenied.InstanceCreating
The specified instance is creating.诊断
403
DependencyViolation.WindowsInstance
The instance creating is windows, cannot use ssh key pair to login.诊断
403
InvalidParameter.NotMatch
%s诊断
403
ResourcesNotInSameZone
The specified instance and disk are not in the same zone.诊断
403
OperationDenied.UnpaidOrder
The specified instance has unpaid order.诊断
403
InvalidHostname.MismatchImage
The hostname of the current instance can not be applied to the image you choose.诊断
403
HibernationConfigured.InstanceOperationForbidden
The operation is not permitted due to limit of the hibernation configured instance.诊断
403
InvalidOperation.MultiAttachDisk
Multi attach disk does not support this operation.诊断
403
InvalidRegionId.NotSupportEncryptAlgorithm
The current region does not support creating encrypted disks with EncryptAlgorithm.诊断
403
InvalidRegionId.NotExists
The region not exists.诊断
403
InvalidEncryptAlgorithm
The specified parameter EncryptAlgorithm is not valid.诊断
403
InvalidEncrypted.NotMatchKmsKeyId
The specified parameter Encrypted must be true when KmsKeyId is not empty.诊断
403
InvalidEncrypted.NotMatchEncryptAlgorithm
The specified parameter Encrypted must be true when EncryptAlgorithm is not empty.诊断
403
InvalidParameter.KmsNotEnabled
The specified operation need enable KMS.诊断
403
InvalidParameter.DataEncryptedKeyCreateFailed
Create kms data encrypted key fail. If you need further assistance, you can contact the KMS Technical Support.诊断
403
InvalidParameter.KMSKeyId.NotFound
The specified KMSKeyId does not exist.诊断
403
InvalidParameter.KMSKeyId.KMSUnauthorized
ECS service have no right to access your KMS.诊断
403
InvalidKMSKeyId.NotSymmetric
The specified parameter KmsKeyId must be symmetric.诊断
403
InvalidDiskId.NotSupportReplaceEncryptedSystemDisk
The specified diskId not support replace encrypted system disk.诊断
403
NotSupportSnapshotEncrypted.DiskCategory
The specified disk category does not support creating encrypted system disks or creating encrypted data disks from snapshots. Check the DiskCategory or Encrypted parameter, or check your account for default encryption settings.诊断
403
InvalidParameter.AllEmpty
The current operation does not allow both diskId and imageId to be empty. Make sure that either diskId or imageId is not empty.诊断
403
InvalidParameter.Conflict
The current operation does not allow both diskId and imageId to be set. Make sure that either diskId or imageId is not empty.诊断
403
OperationDenied
The current region does not support changing the image type.诊断
403
OperationDenied.ImageNotValid
The specified Image is disabled or deleted, please check the status of the image.诊断
403
OperationDenied.DiskNoStock
The requested disk category is sold out in the specified zone. Please try a different disk category or another zone.诊断
403
InvalidParameter.KMSKeyId.CMKNotEnabled
The CMK (Customer Master Key) must be in an active state.诊断
403
InvalidParameter.KMSKeyId.CMKUnauthorized
The CMK(Customer Master Key) lacks authorization to add tags to the ECS service.诊断
403
InvalidEncrypted.NotMatchSnapshot
The specified parameter Encrypted must be set to true when creating disks with encrypted snapshots.诊断
403
InvalidEncrypted.NotMatchDiskDefaultEncryption
Enabling disk default encryption prevents the creation of non-encrypted disks.诊断
403
InvalidPayMethod.SyncPaymentNotSupport
Synchronous payment is not supported. Use another payment method.诊断
404
InvalidInstanceId.NotFound
The specified InstanceId does not exist.诊断
404
InvalidImageId.NotFound
The specified ImageId does not exist.诊断
404
InvalidSystemDiskSize.MoreThanMaxSize
The specified SystemDisk.Size parameter exceeds the maximum size.诊断
404
InvalidSystemDiskSize.LessThanImageSize
The specified parameter SystemDisk.Size is less than the image size.诊断
404
InvalidSystemDiskSize.LessThanMinSize
The specified parameter SystemDisk.Size is less than the min size.诊断
404
NoSuchResource
The specified resource is not found.诊断
500
OperationDenied
Internal Error.诊断
500
InternalError
The request processing has failed due to some unknown error.诊断

变更历史

变更时间变更内容概要操作
2025-03-21
变更错误码400
变更错误码403
2025-03-19
变更错误码400
变更错误码403
2025-03-11
变更错误码400
2025-02-27
变更错误码403
2025-02-12
变更错误码400
2024-12-30
变更错误码400
变更错误码403
  • 1
  • 2
  • 10 条/页

相关示例