CopyImage

Last Updated: Dec 12, 2017

Description

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

  • You can only copy the custom image when it is available.
  • You can only copy the image within your Alibaba Cloud account. Cross-account copying is not allowed.
  • If 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 Required 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, backslashes (), underscores (_), or hyphens (-).
  • 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.
  • Cannot begin with http:// or https://.
The default value is 0, if the parameter is left blank, the default value is filled.
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 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 image

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 image does not exist.
Forbidden User not authorized to operate on the specified resource. 400 Not authorized to copy images.
IncorrectImageStatus The image is not available. 400 The status of the specified source image is incorrect.
InvalidDescription.Malformed The specified destination image description is wrongly formed. 400 The description of the specified destination image is invalid.
InvalidImageName.Duplicated The destination image is exist. 400 The name of the destination image is already in use.
InvalidImageName.Malformed The specified destination Image name is wrongly formed. 400 The name of the specified destination image is invalid.
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.
SourceRegion.NotFound The source region does not exist. 400 The RegionId of the specified source image does not exist.
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.
InvalidImageId.NotFound The specified ImageId does not exist. 403 The ID of the specified source image does not exist.
OperationDeined.EncryptedSnapshot The image contains encrypted snapshots, which do not support copying. 403 The image contains encrypted snapshots, which do not support copying.
OperationDenied.ImageCopying The specified image is being copied. 403 The specified source image is being copied, and cannot be copied again.
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.
RegionNotSupportCopy The region not support copy. 403 The specified regions for the destination or source image do not support image copying.

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>

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. }
Thank you! We've received your feedback.