CopyImage

Last Updated: May 22, 2018

Description

Copies a custom image from one region to other regions. You can use the destination image to create instances or replace system disks. When you call this interface, consider the following:

  • You can only copy the custom image when it is in the available status.

  • You can only copy the image within your Alibaba Cloud account. Coping a cross-account image is not allowed.

  • You cannot delete an image when copying is in progress. However, you can cancel the copying process.

Request parameters

Name Type Required Description
Action String Yes The name of this interface. Value: CopyImage.
RegionId String Yes ID of the region to where the source custom image belongs. For more information, see Regions and zones.
ImageId String Yes ID of the source custom image.
DestinationRegionId String Yes ID of the region to where the destination custom image belongs.
DestinationImageName String No Name of the destination custom image.
  • Can be [2, 128] characters in length
  • Must begin with an uppercase or lowercase English letter, or a Chinese character.
  • Can contain digits, backslashes (\), colons(:), underscores (_), or hyphens (-).
  • Cannot begin with http:// or https://.
DestinationDescription String No The description of the destination custom image.
  • Can be null, but the image description is optional and cannot exceed 256 characters.
  • Cannot begin with http:// or https://.
ClientToken String No Used to guarantee the idempotence of the request. The value is generated by a client. It must be unique among all requests and can only contain up to 64 ASCII characters.
For more information, see How to ensure idempotence.

Response parameters

Name Type Description
ImageId String ID of the destination custom image

Examples

Request example

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

Response 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. }

Error codes

Error code Error message HTTP status code Meaning
DestinationRegion.NotFound The destination region does not exist. 400 The RegionId of the specified source custom image does not exist.
Forbidden User not authorized to operate on the specified resource. 400 You are not authorized to copy images.
IncorrectImageStatus The image is not available. 400 The status of the specified source custom image is incorrect.
InvalidDescription.Malformed The specified destination image description is wrongly formed. 400 The description of the specified destination custom image is invalid.
InvalidImageName.Duplicated The destination image is exist. 400 The name of the destination custom image is already in use.
InvalidImageName.Malformed The specified destination Image name is wrongly formed. 400 The name of the specified destination custom image is invalid.
MissingParameter An input parameter that is mandatory for processing the request is not supplied. 400 You must specify the required parameters.
SourceRegion.NotFound The source region does not exist. 400 The RegionId of the specified source custom image does not exist.
IncorrectDestinationRegion The destination region is not equal the target region. 403 The source region for copying images must be different from the destination region.
InvalidImageId.NotFound The specified ImageId does not exist. 403 The ID of the specified source image does not exist.
InvalidSnapshot.TooOld This operation is denied because the specified snapshot is created before 2013-07-15. 403 The specified ImageId is created on or before July 15, 2013. Please try other images instead.
OperationDeined.EncryptedSnapshot The image contains encrypted snapshots, which do not support copying. 403 The source custom image contains encrypted snapshots, which do not support copying.
OperationDenied.ImageCopying The specified image is being copied. 403 The specified source custom image is being copied. Please try again later.
QuotaExceed.Image The Image Quota exceeds. 403 No more images will be copied because you have exceeded your custom image quota.
QuotaExceed.Snapshot The maximum number of snapshots is exceeded. 403 No more images will be copied because you have exceeded your snapshot quota.
RegionNotSupportCopy The region not support copy. 403 The specified region of the destination or source image does not support image copying.
Thank you! We've received your feedback.