ALIYUN::ECS::CopyImage is used to copy a custom image from one region to another region.

Syntax

{
  "Type": "ALIYUN::ECS::CopyImage",
  "Properties": {
    "Encrypted": Boolean,
    "DestinationImageName": String,
    "ImageId": String,
    "DestinationRegionId": String,
    "SourceRegionId": String,
    "Tag": List,
    "DestinationDescription": String,
    "KMSKeyId": String,
    "ResourceGroupId": String
  }
}

Properties

PropertyTypeRequiredEditableDescriptionConstraint
Encrypted Boolean No No Specifies whether to encrypt the image copy. Default value: false. Valid values:
  • true: encrypts the image copy.
  • false: does not encrypt the image copy.
DestinationImageName String No No The name of the image copy. The name must be 2 to 128 characters in length. The name must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons(:), underscores (_), and hyphens (-).
ImageId String Yes No The ID of the source custom image. None.
DestinationRegionId String Yes No The ID of the region in which the image copy is deployed. None.
SourceRegionIdStringNoNoThe ID of the region in which the source custom image is deployed. By default, the ID of the current region is used.
TagListNoNoThe tags of the image copy. For more information, see Tag properties.
DestinationDescriptionStringNoNoThe description of the image copy. The description must be 2 to 256 characters in length, and cannot start with http:// or https://.
KMSKeyIdStringNoNoThe ID of the key that you want to use to encrypt the image copy. None.
ResourceGroupIdStringNoYesThe ID of the resource group to which the image copy belongs. None.

Tag syntax

"Tag": [
  {
    "Key": String,
    "Value": String
  }
]

Tag properties

PropertyTypeRequiredEditableDescriptionConstraint
Key String No No The key of the tag. The tag key must be 1 to 128 characters in length, and cannot contain http:// or https://. The tag key cannot start with aliyun or acs:.
ValueString NoNoThe value of the tag. The tag value can be up to 128 characters in length, and cannot contain http:// or https://. The tag value cannot start with aliyun or acs:.

Return values

Fn::GetAtt

  • ImageId: the ID of the image copy.
  • DestinationRegionId: the ID of the region in which the image copy is deployed.
  • SourceRegionId: the ID of the region in which the source custom image is deployed.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Description:
       
      en: Create ECS CopyImage
    Parameters:
      ImageId:
        Type: String
        AssociationProperty: ALIYUN::ECS::Image::ImageId
        AssociationPropertyMetadata:
          SupportedImageOwnerAlias:
            - self
    Resources:
      CopyImage:
        Type: ALIYUN::ECS::CopyImage
        Properties:
          Encrypted: false
          ImageId:
            Ref: ImageId
          DestinationRegionId: cn-shanghai
          SourceRegionId: cn-hangzhou
          DestinationDescription: Test CopyImage
    Outputs:
      CopyImageId:
        Value:
          Fn::GetAtt:
            - CopyImage
            - ImageId                    
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Description": {
         
        "en": "Create ECS CopyImage"
      },
      "Parameters": {
        "ImageId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::ECS::Image::ImageId",
          "AssociationPropertyMetadata": {
            "SupportedImageOwnerAlias": [
              "self"
            ]
          }
        }
      },
      "Resources": {
        "CopyImage": {
          "Type": "ALIYUN::ECS::CopyImage",
          "Properties": {
            "Encrypted": false,
            "ImageId": {
              "Ref": "ImageId"
            },
            "DestinationRegionId": "cn-shanghai",
            "SourceRegionId": "cn-hangzhou",
            "DestinationDescription": "Test CopyImage"
          }
        }
      },
      "Outputs": {
        "CopyImageId": {
          "Value": {
            "Fn::GetAtt": [
              "CopyImage",
              "ImageId"
            ]
          }
        }
      }
    }            

For more examples, visit CustomImage.json and CustomImage.yml. In the examples, the ALIYUN::ECS::CustomImage and ALIYUN::ECS::CopyImage resource types are used.