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

Elastic Compute Service:CopyImage

最終更新日:Apr 04, 2026

あるリージョンから別のリージョンにカスタムイメージをコピーします。カスタムイメージをコピーして、リージョン間で Elastic Compute Service (ECS) インスタンスをデプロイまたはコピーできます。

操作説明

注意事項

カスタムイメージをターゲットリージョンにコピーした後、そのイメージコピー (新しいイメージ) を使用して、RunInstances 操作を呼び出して ECS インスタンスを作成したり、ReplaceSystemDisk 操作を呼び出してターゲットリージョン内のインスタンスのシステムディスクを置き換えたりすることができます。

次の点にご注意ください。

  • Available 状態のカスタムイメージのみコピーできます。

  • ご利用の Alibaba Cloud アカウントに属するカスタムイメージは、リージョン間でコピーできます。他者から共有されたイメージは、そのイメージが存在するリージョン内でのみコピーできます。

  • イメージのコピー中は、DeleteImage 操作を呼び出して新しいイメージを削除することはできません。ただし、CancelCopyImage 操作を呼び出して、進行中のイメージコピータスクをキャンセルすることはできます。

  • 1 つのリージョンでサポートされる同時イメージコピータスクは 5 つまでです。超過したイメージコピータスクは、実行のためにキューに入れられます。

  • ResourceGroupId を設定して、新しいイメージを割り当てるリソースグループを指定できます。ResourceGroupId を設定しない場合、新しいイメージはデフォルトのリソースグループに割り当てられます。

今すぐお試しください

この 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:CopyImage

update

*Image

acs:ecs:{#regionId}:{#accountId}:image/*

なし なし

リクエストパラメーター

パラメーター

必須 / 任意

説明

DestinationImageName

string

任意

新しいイメージの名前。名前は 2~128 文字である必要があります。名前は文字で始まる必要があり、http:// または https:// を含めることはできません。名前を acs: または aliyun で始めることはできません。名前には、文字、数字、ピリオド (.)、コロン (:)、アンダースコア (_)、ハイフン (-) を使用できます。

YourImageName

DestinationDescription

string

任意

イメージコピーの説明。説明は 2~256 文字である必要があり、http:// または https:// で始めることはできません。

This is a description example.

ImageId

string

必須

ソースカスタムイメージの ID。

m-bp1h46wfpjsjastc****

RegionId

string

必須

ソースカスタムイメージのリージョン ID。DescribeRegions 操作を呼び出して、最新のリージョンリストをクエリできます。

cn-hangzhou

DestinationRegionId

string

任意

ソースカスタムイメージのコピー先となるターゲットリージョンの ID。

cn-shanghai

Encrypted

boolean

任意

新しいイメージを暗号化するかどうかを指定します。

  • true

  • false

デフォルト値: false。

false

KMSKeyId

string

任意

イメージコピーの暗号化に使用されるキーの ID。

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

EncryptAlgorithm

string

任意

説明

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

hide

ResourceGroupId

string

任意

新しいイメージを割り当てるリソースグループの ID。このパラメーターを指定しない場合、新しいイメージはデフォルトのリソースグループに割り当てられます。

説明

デフォルトのリソースグループを管理する権限を持たない Resource Access Management (RAM) ユーザーとして CopyImage 操作を呼び出し、かつ ResourceGroupId を指定しない場合、Forbidden: User not authorized to operate on the specified resource というエラーメッセージが返されます。CopyImage 操作を再度呼び出す前に、RAM ユーザーが管理権限を持つリソースグループの ID を指定するか、RAM ユーザーにデフォルトのリソースグループを管理する権限を付与する必要があります。

rg-bp67acfmxazb4p****

Tag

array<object>

任意

タグのリスト。

object

任意

タグのリスト。

Value

string

任意

イメージコピーのタグ N の値。N の有効値:1~20。タグ値は空の文字列にすることができます。タグ値は最大 128 文字で、acs: で始めることはできません。http:// または https:// を含めることはできません。

TestValue

Key

string

任意

イメージコピーのタグ N のキー。N の有効値:1~20。タグキーは空の文字列にすることはできません。タグキーは最大 128 文字で、http:// または https:// を含めることはできません。タグキーを aliyun または acs: で始めることはできません。

TestKey

DryRun

boolean

任意

実際のリクエストを実行せずに、ドライランのみを実行するかどうかを指定します。インスタンスで使用されているイメージがホットマイグレーションをサポートしているかどうかを確認するかどうかを指定します。有効値:

  • true:ドライランのみを実行します。システムは、無効な AccessKey ペア、権限のない RAM ユーザー、不足しているパラメーター値など、リクエストに潜在的な問題がないか確認します。リクエストがドライランに失敗した場合、エラーメッセージが返されます。リクエストがドライランに成功した場合、DryRunOperation エラーコードが返されます。

  • false:ドライランを実行し、実際のリクエストを実行します。リクエストがドライランに成功した場合、2xx HTTP ステータスコードが返され、操作が実行されます。

デフォルト値: false。

false

ClientToken

string

任意

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

123e4567-e89b-12d3-a456-426655440000

レスポンスフィールド

フィールド

説明

object

ImageId

string

イメージコピーの ID。

m-bp1h46wfpjsjastd****

RequestId

string

リクエスト ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

成功レスポンス

JSONJSON

{
  "ImageId": "m-bp1h46wfpjsjastd****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

エラーレスポンス

JSONJSON

{
    "RequestId": "C8B26B44-0189-443E-9816-D951F59623A9",
    "ImageId": "Img-231234567"
}

エラーコード

HTTP ステータスコード

エラーコード

エラーメッセージ

説明

400 InvalidDescription.Malformed The specified destination description is wrongly formed.
400 SourceRegion.NotFound The source region not found.
400 DestinationRegion.NotFound The destination region not found.
400 IncorrectImageStatus The image not available.
400 InvalidSnapshotId.NotFound The specified SnapshotId does not exist.
400 InvalidImageName.Duplicated The specified image name is already in use in the target region. Please try a different one.
400 InvalidParameter.EncryptedIllegal The specified parameter Encrypted must be true when kmsKeyId is not empty.
400 InvalidEncrypted.NotMatchEncryptAlgorithm The specified parameter Encrypted must be true when EncryptAlgorithm is not empty.
400 InvalidEncryptAlgorithm The specified parameter EncryptAlgorithm is not valid.
400 InvalidEncrypted.NotMatchKmsKeyId The specified parameter Encrypted must be true when KmsKeyId is not empty.
400 OperationDenied.CommunityImage Community image does not support copy.
400 InvalidImageName.Malformed The specified destination image name is wrongly formed.
400 InvalidParameter.KmsNotEnabled The specified operation need enable KMS.
400 OperationDenied.ImageCopyConflict The same image cannot be copied concurrently. Please wait until the last copy is completed before performing the next operation.
400 Account.Arrearage Your account has an outstanding payment.
400 Duplicate.TagKey The Tag.N.Key contain duplicate key.
401 InvalidAliUid.IsNull The aliUid must not be null.
500 InternalError The request processing has failed due to some unknown error, exception or failure.
403 Forbbiden User not authorized to operate on the specified resource.
403 InvalidOperation.CopyingDataFromThisRegionUnsupported Data transfer from the current region to other regions is not supported.
403 InvalidOperation.CopyingDataToThisRegionUnsupported Only Some Regions %s can copy data to this region.
403 QuotaExceed.Image The number of images exceeds the limit (%s).
403 QuotaExceed.Snapshot The snapshot quota exceeds.
403 OperationDenied.ImageCopying The image is currently being copied. Please try again later.
403 RegionNotSupportCopy The region not support copy.
403 InvalidSnapshot.TooOld This operation is denied because the specified snapshot is created before 2013-07-15.
403 OperationDenied The specified snapshot is not allowed to create image.
403 IncorrectDestinationRegion The destination region is not equal the target region.
403 OperationDeined.EncryptedSnapshot The image contains encrypted snapshots, which do not support copying.
403 OperationDenied.SameRegionOnly The image shared from others can not be copied to another region directly.
403 OperationDenied.NotPublished The operation is denied because corresponding marketplace image is not published in destination region.
403 OperationDenied.NotAuthorized The operation is denied because corresponding marketplace image is not authorized to current user.
403 OperationDenied.EncryptSnapshotAcrossRegion The image do not contain encrypted snapshots, which do not support copying to encrypted ones.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service have no right to access your KMS.
403 InvalidRegion.NotSupport The specified region does not support byok.
403 UserNotInTheWhiteList The user is not in byok white list.
403 InvalidRegionId.NotSupportEncryptAlgorithm The current region does not support creating encrypted disks with EncryptAlgorithm.
403 OperationDenied.KmsServiceUnauthorized The account is not authorized to kms service, please authorize it.
403 OperationDenied.NonCompliantDestinationRegion The copy operation to the destination region is not in compliance with regulations.
403 InvalidEncrypted.NotMatchDiskDefaultEncryption The specified parameter Encrypted not match for your account default encryption settings.
403 InvalidParameter.DataEncryptedKeyCreateFailed Create kms data encrypted key fail. If you need further assistance, you can contact the KMS Technical Support.
403 SizeExceed.Image The image exceeds the maximum size. You can use the CopySnapshot API to copy your snapshots of the image and then create a new image from them.
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 InvalidOperation.VhdImageUnsupported The specified vhd image is not supported for this operation. Please switch to a raw image and retry.
403 InvalidOperation.CloudBoxImageCopyUnsupported Copying CloudBox images is not supported.
404 InvalidImageId.NotFound The specified ImageId does not exist.
404 InvalidParameter.KMSKeyId.NotFound The specified KMSKeyId does not exist.
404 InvalidResourceGroup.NotFound The ResourceGroup provided does not exist in our records.
409 InvalidOperation.Conflict Request was denied due to conflict with a previous request, please try again later.

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

変更履歴

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