Copy an image

Last Updated: Aug 21, 2017

Description

This operation allows you to copy custom images from one region to another for consistent deployment across regions. Copied images can be used to create instances, replace system disks, and perform other operations in other regions. When copying an image, consider the following:

  • Only available custom images can be copied.

  • Image copying is only allowed under the current account. Cross-account copying is not supported.

  • If the copying is not completed, you cannot delete the image. However, you can cancel the copying process.

Request parameters

Name Type Required Description
Action String Yes Mandatory parameters. Value: CopyImage.
RegionId String Yes Indicates the RegionId of the source custom image.
ImageId String Yes Indicates the ID of the source custom image.
DestinationRegionId String Yes Allows you to copy to the destination RegionId.
DestinationImageName String No This parameter indicates the name of the destination image. The destination image name can be 2 to 128 characters in length and:
  • Must begin with an uppercase or lowercase English letter, or a Chinese character.
  • Can contain digits, “\”, “_”, or “-“.
  • Cannot begin with http:// or https:// .
DestinationDescription String No This parameter indicates the description of the destination image. The description can be 0 to 256 characters in length and cannot begin with http:// or https:// . By default, the value is zero. If the parameter is left blank, the default value will be used.
ClientToken String No Used to ensure the idempotence of the request. The value is generated by a client. It must be unique among all requests and can contain up to 64 ASCII characters. For details, refer to the appendix How to Ensure Idempotence.

Return parameters

Name Type Description
ImageId String ID of the destination image

Error code

Error code Description Http status code Meaning
MissingParameter An input parameter RegionId that is mandatory for processing the request is not supplied. 400 RegionId value is missing.
MissingParameter An input parameter ImageId that is mandatory for processing the request is not supplied. 400 ImageId value is missing.
MissingParameter An input parameter DestinationRegionId that is mandatory for processing the request is not supplied. 400 DestinationRegionId value is missing.
OperationDeined.EncryptedSnapshot The image contains encrypted snapshots, which do not support copying. 403 The image contains encrypted snapshots, which do not support copying.
InvalidImageId.NotFound The specified ImageId does not exist. 403 The ID of the specified source image does not exist.
InvalidImageName.Malformed The specified destination Image name is wrongly formed. 400 The name of the specified destination image is invalid.
InvalidDescription.Malformed The specified destination image description is wrongly formed. 400 The description of the specified destination image is invalid.
SourceRegion.NotFound The source region does not exist. 400 The RegionId of the specified source image does not exist.
DestinationRegion.NotFound The destination region does not exist. 400 The RegionId of the specified source image does not exist.
IncorrectImageStatus The image is not available. 400 The status of the specified source image is incorrect.
InvalidImageName.Duplicated The destination image is exist. 400 The name of the destination image is already in use.
QuotaExceed.Image The Image Quota exceeds. 403 No more images will be copied as the custom image quota has exceeded.
QuotaExceed.Snapshot The maximum number of snapshots is exceeded. 403 No more images will be copied as the snapshot quota has exceeded.
Forbidden User not authorized to operate on the specified resource. 400 Not authorized to copy images.
OperationDenied.ImageCopying The specified image is being copied. 403 The specified source image is being copied, and cannot be copied again.
RegionNotSupportCopy The region not support copy. 403 The specified regions for the destination or source image do not support image copying.
IncorrectDestinationRegion The destination region is not equal the target region. 403 The source region for copying images must not be the same as the destination region.

Examples

Request example

  1. https://ecs.aliyuncs.com/?Action=CopyImage
  2. &DestinationRegionId=cn-hangzhou
  3. &ImageId=m-281234567
  4. &RegionId=cn-qingdao
  5. &<Public Request Parameters>

Return example

XML format

  1. <CopyImageResponse>
  2. <RequestId>C8B26B44-0189-443E-9816-D951F59623A9</RequestId>
  3. <ImageId>Img-231234567</ImageId>
  4. </CopyImageResponse>

JSON format

  1. {
  2. "RequestId": "C8B26B44-0189-443E-9816-D951F59623A9",
  3. "ImageId": "Img-231234567"
  4. }
Thank you! We've received your feedback.