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

Elastic Compute Service:ReplaceSystemDisk

最終更新日:Sep 15, 2026

システムディスクを置き換えることで、ECS インスタンスのオペレーティングシステムを置き換えます。置き換え後、システムディスクのディスク ID が変更され、元のディスクはリリースされます。

操作説明

この操作の呼び出し前に、システムディスクの置き換え (オペレーティングシステムの置き換え) を注意深くお読みください。

システムディスクを置き換える際は、次の点に注意してください。

  • システムディスクの支払方法を変更できません。

  • システムディスクのディスクタイプを変更できません。

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

  • インスタンスは Stopped 状態である必要があります。

    説明

    これは VPC タイプのインスタンスにのみ適用されます。ECS インスタンスが従量課金制の支払方法を使用しており、デフォルトで節約モードが有効になっている場合は、インスタンスを停止するときに標準停止モードに設定します。これにより、リージョン内の ECS インスタンスの在庫不足により、システムディスクの置き換え後にインスタンスの再起動が失敗することを防ぎます。詳細については、 StopInstance をご参照ください。

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

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

システムディスクを置き換えた後、 DescribeInstances を呼び出してインスタンスステータスを照会し、置き換えが成功したかどうかを確認します。返される 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: Max{1, ImageId パラメーターで指定されたイメージサイズ} ~ 2048。

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

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

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

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

  • その他のディスクタイプ: Max{20, ImageId パラメーターで指定されたイメージサイズ} ~ 2048。

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

説明

Max{20, 元のシステムディスク容量} を超えるディスク容量には追加料金が発生します。

80

ClientToken

string

任意

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

123e4567-e89b-12d3-a456-426655440000

UseAdditionalService

boolean

任意

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

説明

このパラメーターは、システムディスクがアタッチされている場合 (つまり、デバイス名が /dev/xvda の場合) にのみ効果があります。

true

Password

string

任意

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

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

Windows インスタンスの場合、パスワードの先頭をスラッシュ (/) にすることはできません。

デフォルト値: パスワードは変更されません。

説明

Password パラメーターを指定する場合は、パスワードの漏洩を防ぐために HTTPS を使用してリクエストを送信してください。

EcsV587!

PasswordInherit

boolean

任意

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

デフォルト値: false。

説明

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

false

KeyPairName

string

任意

キーペアの名前。

説明

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

testKeyPairName

DiskId

string

任意

説明

[非推奨] このパラメーターは非推奨です。互換性を向上させるには、代わりに ImageId を使用してください。

d-bp67acfmxazb4ph****

Platform

string

任意

説明

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

CentOS

Architecture

string

任意

説明

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

i386

SecurityEnhancementStrategy

string

任意

システムディスクの置き換え後にセキュリティセンターを無料で使用するかどうかを指定します。有効な値:

  • Active: アクティブな。セキュリティセンターを使用します。この値はパブリックイメージでのみサポートされています。

  • Deactive: セキュリティセンターを使用しません。この値はすべてのイメージでサポートされています。

デフォルト値: 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

任意

AssumeRoleFor

integer

任意

説明

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

0

RoleType

string

任意

説明

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

null

Rolearn

string

任意

説明

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

null

レスポンスフィールド

フィールド

型

説明

例

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. 指定された Password パラメーターが無効です。
400 InvalidPasswordParam.Mismatch The input password should be null when passwdInherit is true. PasswdInherit が有効な場合、ユーザー名とパスワードは空である必要があります。
400 OperationDenied The specified image contains the snapshot of the data disk. This operation is not supported.
400 InvalidDiskCategory.ValueNotSupported The specified parameter "DiskCategory" is not valid. 指定されたシステムディスクタイプおよびデータディスクタイプはサポートされていません。
400 InvalidKeyPairName.NotFound The specified KeyPairName does not exist. 指定された KeyPairName が存在しません。
400 DependencyViolation.IoOptimize The specified parameter InstanceId is not valid. 指定されたインスタンス ID が無効であるか、または指定されたインスタンスの I/O 最適化構成が無効です。
400 MissingParameter.Architecture Architecture should not be null. Architecture パラメーターを空にすることはできません。
400 InvalidArchitecture.Malformed Architecture is not valid. Architecture パラメーターのフォーマットが無効です。
400 MissingParameter.Platform Platform should not be null. Platform パラメーターのフォームを空にすることはできません。
400 InvalidPlatform.Malformed Platform is not valid. 指定されたイメージのオペレーティングシステムのディストリビューションが無効です。
400 InvalidDiskId.NotFound The specified disk do not exist. 指定されたディスクが存在しません。ディスク ID が正しいかどうかを確認してください。
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. 指定されたインスタンスにシステムディスクがアタッチされていません。指定されたインスタンスにシステムディスクがアタッチされていることを確認してください。DescribeInstances を呼び出して、指定されたインスタンスの情報をクエリできます。
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. 指定された InstanceType はサポートされていません。
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. エンタープライズクラウド移行のお客様は、従量課金制の ECS インスタンスのみを購入でき、Alibaba Cloud Marketplace が提供するイメージなどのサードパーティプロダクトは購入できません。パラメーターを確認し、有効なパラメーターでリトライしてください。
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. ディスク名のフォームが無効です。名前は 2~128 文字で、英字または漢字で始まる必要があります。数字、ピリオド (.)、アンダースコア (_)、ハイフン (-) を含めることができます。http:// または https:// で始めることはできません。
400 InvalidParameter.Encrypted Creating non-encrypted disks from encrypted snapshots is not allowed. Please set Encrypted to true or use an unencrypted snapshot.
400 InvalidParam.EncryptedMismatch Creating a disk from a shared encrypted image requires encryption with your own KMS key. Please set the Encrypted parameter to true.
500 OperationDenied Internal Error.
500 InternalError The request processing has failed due to an internal error and you may retry later or contact support with the request ID.
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. The system disk is transferring.
403 IncorrectDiskStatus The current disk status does not support this operation.
403 IncorrectInstanceStatus The instance must be in the Stopped state when you replace the system disk. Please stop the instance and try again.
403 InstanceLockedForSecurity The instance is locked due to security. ディスクがアタッチされているインスタンスは、セキュリティ上の理由によりロック済みです。
403 ImageNotSubscribed The specified image has not be subscribed.
403 ImageRemovedInMarket The specified marketplace image is not available. Or the specified user-defined image includes a product code because it is based on an image subscribed from the marketplace; and that marketplace image including the exact 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 does not support IoOptimized instances.
403 OperationDenied.ImageNotValid The specified marketplace image is not authorized. Please verify the marketplace image authorization and try again.
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 runs Windows and does not support SSH key pair 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. 指定されたインスタンス ID に対して未払いの注文がすでに存在します。ECS コンソールにログインして支払いを完了できます。
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 EncryptAlgorithm is not valid. Ensure the value is a supported encryption algorithm such as AES-256.
403 InvalidEncrypted.NotMatchKmsKeyId The Encrypted parameter must be set to true when KMSKeyId is specified. Please adjust the parameters and try again.
403 InvalidEncrypted.NotMatchEncryptAlgorithm The Encrypted parameter must be set to true when EncryptAlgorithm is specified. Please adjust the parameters and try again.
403 InvalidParameter.KmsNotEnabled The specified operation need enable KMS.
403 InvalidParameter.DataEncryptedKeyCreateFailed The ECS service is not authorized to access your KMS key. Please grant the ECS service permission to use the key and try again.
403 InvalidParameter.KMSKeyId.NotFound The specified KMSKeyId does not exist. Please verify that the key ID is correct and that the key resides in the current region.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service does not have permission to access your KMS key. Please verify that the specified KMS key has authorized the ECS service.
403 InvalidKMSKeyId.NotSymmetric The specified KMSKeyId must be a symmetric key. Please use a symmetric KMS key such as an AES-256 key.
403 InvalidDiskId.NotSupportReplaceEncryptedSystemDisk The specified diskId not support replace encrypted system disk.
403 NotSupportSnapshotEncrypted.DiskCategory The specified disk category does not support re-encrypting a disk with a new KMSKeyId from a snapshot. Please use a disk category that supports encryption such as cloud_essd.
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.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 specified KMS key must be in an enabled state. Please enable the key in the KMS console and try again.
403 InvalidParameter.KMSKeyId.CMKUnauthorized The specified KMS key is not authorized for the ECS service. Please grant the ECS service permission to use the key in the KMS console and try again.
403 InvalidEncrypted.NotMatchSnapshot The Encrypted parameter must be set to true when creating disks from encrypted snapshots. Please set Encrypted to true or use an unencrypted snapshot.
403 InvalidEncrypted.NotMatchDiskDefaultEncryption The operation failed because default disk encryption is enforced on your account. Please set the Encrypted parameter to true.
403 InvalidPayMethod.SyncPaymentNotSupport Synchronous payment is not supported. Use another payment method. 現在のステータスでは自動支払いがサポートされていません。AutoPay パラメーターを別の支払方法に設定してください。
403 InvalidOperation.ImageSecureBootUnsupported The image does not support secure boot. このイメージはセキュアブートをサポートしていません。
403 InvalidDiskCategory.NotSupported The disk category is not supported in the current zone. Please call DescribeAvailableResource to check supported categories.
403 OperationDenied.KMSKeyUnauthorized The operation is denied due to missing KMS key authorization. Please check the KMS key permissions and ensure the key is properly authorized for this operation.
403 InvalidOperation.TargetImageIncompatible The source image cannot be replaced by the target image.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. 指定されたインスタンスが存在しません。インスタンス ID が正しいかどうかを確認してください。
404 InvalidImageId.NotFound The specified ImageId does not exist. このアカウントの下に指定されたイメージが存在しません。イメージ ID が正しいかどうかを確認してください。
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. 指定されたリソースが存在しません。

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

変更履歴

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