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

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

Tag syntax

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

Tag properties

Property Type Required Editable Description Constraint
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 key cannot start with acs: or aliyun.
Value String No No The value of the tag. The tag value must be 0 to 128 characters in length, and cannot contain http:// or https://. The value cannot start with acs: or aliyun.

Return values

Fn::GetAtt

  • ImageId: the ID of the copy of the custom image.
  • DestinationRegionId: the ID of the region to which the copy of the custom image belongs.
  • SourceRegionId: the ID of the region to which the source custom image belongs.

Examples

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
     
    "en": "Create ECS CopyImage"
  },
  "Parameters": {
    "DestinationRegionId": {
      "Type": "String",
      "Description": "ID of the region to where the destination custom image belongs.",
      "Default": "cn-shanghai"
    },
    "SourceRegionId": {
      "Type": "String",
      "Description": "ID of the region to where the source image belongs. Default is current region ID.",
      "Default": "cn-hangzhou"
    },
    "ImageId": {
      "Type": "String",
      "Description": "Image Id, represents the image resource to startup one ECS instance",
      "Label": "ECS Image Id",
      "Default": "m-bp******"
    }
  },
  "Resources": {
    "CopyImage": {
      "Type": "ALIYUN::ECS::CopyImage",
      "Properties": {
        "Encrypted": false,
        "ImageId": {
          "Ref": "ImageId"
        },
        "DestinationRegionId": {
          "Ref": "DestinationRegionId"
        },
        "SourceRegionId": {
          "Ref": "SourceRegionId"
        },
        "DestinationDescription": "Test CopyImage"
      }
    }
  },
  "Outputs": {
    "CopyImageId": {
      "Value": {
        "Fn::GetAtt": [
          "CopyImage",
          "ImageId"
        ]
      }
    }
  }
}
            

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