すべてのプロダクト
Search
ドキュメントセンター

Elastic Compute Service:ReplaceSystemDisk

最終更新日:Apr 04, 2026

Elastic Compute Service (ECS) インスタンスのオペレーティングシステム (システムディスク) を交換します。ECS インスタンスのオペレーティングシステムを交換すると、インスタンスの元のシステムディスクはリリースされ、新しいシステムディスクがインスタンス用に生成されます。これにより、システムディスクの ID が変更されます。

操作説明

この API を呼び出す前に、「システムディスクの交換 (オペレーティングシステムの交換)」をよくお読みください。

システムディスクを交換する際は、次の点にご注意ください。

  • システムディスクの課金方法の変更はサポートされていません。

  • システムディスクの種類の変更はサポートされていません。

  • システムディスクがアタッチされている ECS インスタンスに未払いの注文があってはなりません。

  • インスタンスは停止済み (Stopped) 状態である必要があります。

    説明

    VPC (Virtual Private Cloud) タイプのインスタンスにのみ適用されます。ECS インスタンスが従量課金モードで、「停止中のインスタンスに対する課金」が有効になっている場合、リージョン内の ECS インスタンスの在庫不足により、システムディスク交換後にインスタンスを再起動できなくなるのを防ぐため、インスタンスを停止する際には通常の停止モードに設定する必要があります。詳細については、「StopInstance」をご参照ください。

  • パラメーター SystemDisk.Size を使用して、システムディスクの新しい容量を指定できます (元のシステムディスクの容量より小さくすることはできません)。

  • ECS インスタンスがセキュリティロックされている場合、つまりインスタンスの OperationLocks パラメーターの値に "LockReason": "security" が含まれている場合、システムディスクの交換はサポートされません。詳細については、「セキュリティロック時の API の動作」をご参照ください。

システムディスクを交換した後、DescribeInstances API を呼び出して、システムディスクが交換されたインスタンスのステータスを照会し、交換が成功したかどうかを確認できます。戻り値の OperationLocks が空の場合、システムディスクの交換操作は完了しています。

今すぐお試しください

この API を OpenAPI Explorer でお試しください。手作業による署名は必要ありません。呼び出しに成功すると、入力したパラメーターに基づき、資格情報が組み込まれた SDK コードが自動的に生成されます。このコードをダウンロードしてローカルで使用できます。

テスト

RAM 認証

下表に、この API を呼び出すために必要な認証情報を示します。認証情報は、RAM (Resource Access Management) ポリシーを使用して定義できます。以下で各列名について説明します。

  • アクション:特定のリソースに対して実行可能な操作。ポリシー構文ではAction要素として指定します。

  • API:アクションを具体的に実行するための API。

  • アクセスレベル:各 API に対して事前定義されているアクセスの種類。有効な値:create、list、get、update、delete。

  • リソースタイプ:アクションが作用するリソースの種類。リソースレベルでの権限をサポートするかどうかを示すことができます。ポリシーの有効性を確保するため、アクションの対象として適切なリソースを指定してください。

    • リソースレベルの権限を持つ API の場合、必要なリソースタイプはアスタリスク (*) でマークされます。ポリシーのResource要素で対応する ARN を指定してください。

    • リソースレベルの権限を持たない API の場合、「すべてのリソース」と表示され、ポリシーのResource要素でアスタリスク (*) でマークされます。

  • 条件キー:サービスによって定義された条件のキー。このキーにより、きめ細やかなアクセス制御が可能になります。この制御は、アクション単体に適用することも、特定のリソースに対するアクションに適用することもできます。Alibaba Cloud は、サービス固有の条件キーに加えて、すべての RAM 統合サービスに適用可能な一連の共通条件キーを提供しています。

  • 依存アクション:ある特定のアクションを実行するために、前提として実行が必要となる他のアクション。依存アクションの権限も RAM ユーザーまたは 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
なし

リクエストパラメーター

パラメーター

必須 / 任意

説明

InstanceId

string

必須

オペレーティングシステムを交換するインスタンスの ID。

説明

インスタンスが停止済み (Stopped) 状態であることを確認してください。

i-bp67acfmxazb4ph****

ImageId

string

任意

システムディスクの交換に使用するイメージの ID。このパラメーターは必須です。

m-bp67acfmxazb4ph****

SystemDisk.Size

integer

任意

新しいシステムディスクの容量。単位: GiB。有効な値:

  • ベーシックディスク: Max{20, ImageId で指定されたイメージのサイズ}~500。

  • ESSD (エンタープライズ SSD):

    • PL0 ESSD: Max{1, ImageId で指定されたイメージのサイズ}~2048。

    • PL1 ESSD: Max{20, ImageId で指定されたイメージのサイズ}~2048。

    • PL2 ESSD: Max{461, ImageId で指定されたイメージのサイズ}~2048。

    • PL3 ESSD: Max{1261, ImageId で指定されたイメージのサイズ}~2048。

  • ESSD AutoPL ディスク: Max{1, ImageId で指定されたイメージのサイズ}~2048。

  • その他のディスクカテゴリ: Max{20, ImageId で指定されたイメージのサイズ}~2048。

デフォルト値: Max{40, ImageId で指定されたイメージのサイズ}。

説明

新しいシステムディスクの容量が Max{20, 元のシステムディスクの容量} を超える場合、超過分の容量に対して課金されます。

80

ClientToken

string

任意

リクエストのべき等性を保証するために使用されるクライアントトークン。クライアントを使用してトークンを生成できますが、トークンがリクエスト間で一意であることを確認する必要があります。トークンには ASCII 文字のみを含めることができ、長さは 64 文字を超えることはできません。詳細については、「べき等性を確保する方法」をご参照ください。

123e4567-e89b-12d3-a456-426655440000

UseAdditionalService

boolean

任意

Alibaba Cloud が提供する仮想マシンのシステム構成を使用するかどうかを指定します。Windows のシステム構成: NTP と KMS。Linux のシステム構成: NTP と YUM。

説明

このパラメーターは、デバイス名が /dev/xvda のシステムディスクをアタッチする場合にのみ有効です。

true

Password

string

任意

インスタンスのパスワードをリセットするかどうかを指定します。パスワードは 8~30 文字で、大文字、小文字、数字、特殊文字のうち少なくとも 3 種類を含める必要があります。使用できる特殊文字は次のとおりです。

()`~!@#$%^&*-_+=|{}[]:;'<>,.?/

Windows インスタンスのパスワードは、スラッシュ (/) で始めることはできません。

このパラメーターはデフォルトで空であり、現在のパスワードが変更されないことを示します。

説明

Password を指定する場合は、パスワードの漏洩を防ぐために HTTPS 経由でリクエストを送信することを推奨します。

EcsV587!

PasswordInherit

boolean

任意

イメージのプリセットパスワードを使用するかどうかを指定します。

デフォルト値: false

説明

PasswordInherit パラメーターを指定する場合は、Password パラメーターを空のままにする必要があります。このパラメーターを使用する前に、イメージにパスワードがプリセットされていることを確認してください。

false

KeyPairName

string

任意

キーペアの名前。

説明

このパラメーターは Linux インスタンスにのみ適用されます。SSH キーペアをインスタンスにログイン認証情報としてバインドできます。SSH キーペアをバインドすると、インスタンスのユーザー名とパスワードによるログイン方法は無効になります。

testKeyPairName

DiskId

string

任意

説明

このパラメーターは非推奨です。互換性を向上させるために、ImageId を使用することを推奨します。

d-bp67acfmxazb4ph****

Platform

string

任意

説明

このパラメーターは非推奨です。

CentOS

Architecture

string

任意

説明

このパラメーターは非推奨です。

i386

SecurityEnhancementStrategy

string

任意

システムディスク交換後に Security Center の無料版を使用するかどうかを指定します。有効な値:

  • Active:システムディスクの再初期化後に Security Center の無料版を使用します。この値はパブリックイメージにのみ適用されます。

  • Deactive:システムディスクの再初期化後に Security Center の無料版を使用しません。この値はすべてのイメージに適用されます。

デフォルト値: Deactive。

Active

Encrypted

boolean

任意

ディスクを暗号化するかどうかを指定します。有効な値:

  • true

  • false

デフォルト値: false。

説明

暗号化されたスナップショットに基づいてディスクを作成するために共有暗号化イメージを使用する場合、ディスクが独自の暗号鍵を使用するように、Encrypted を true に設定する必要があります。

false

KMSKeyId

string

任意

システムディスクに使用する KMS キーの ID。

e522b26d-abf6-4e0d-b5da-04b7******3c

EncryptAlgorithm

string

任意

説明

このパラメーターはパブリック利用できません。

hide

Arn

array<object>

任意

このパラメーターはパブリック利用できません。

object

任意

RoleType

string

任意

説明

このパラメーターはパブリック利用できません。

null

Rolearn

string

任意

説明

このパラメーターはパブリック利用できません。

null

AssumeRoleFor

integer

任意

説明

このパラメーターは利用できません。

0

レスポンスフィールド

フィールド

説明

object

DiskId

string

新しいシステムディスクの ID。

d-bp67acfmxazb4ph****

RequestId

string

リクエスト ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

成功レスポンス

JSONJSON

{
  "DiskId": "d-bp67acfmxazb4ph****",
  "RequestId": "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.
400 InvalidDiskName.Malformed The specified parameter "SyatemDisk.DiskName or DataDisk.n.DiskName" is not valid.
400 InvalidParameter.Encrypted Creating non-encrypted disks with encrypted snapshots is not supported.
500 OperationDenied Internal Error.
500 InternalError The request processing has failed due to some unknown error.
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.

完全なリストについては、「エラーコード」をご参照ください。

変更履歴

完全なリストについては、「変更履歴」をご参照ください。