All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::CopyImage

Last Updated:Feb 08, 2024

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,
    "AllowCopyInSameRegion": Boolean
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

Encrypted

Boolean

No

No

Specifies whether to encrypt the destination custom image.

Valid values:

  • true

  • false (default)

DestinationImageName

String

No

No

The name of the destination custom image.

The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It 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 destination region.

None.

SourceRegionId

String

No

No

The ID of the source region.

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 destination custom image.

The description must be 2 to 256 characters in length. It cannot start with http:// or https://.

KMSKeyId

String

No

No

The ID of the key that is used to encrypt the custom image.

None.

ResourceGroupId

String

No

Yes

The ID of the resource group.

None.

AllowCopyInSameRegion

Boolean

No

No

Specifies whether to disallow image copy within the same region.

Valid values:

  • true: disallows image copy within the same region, returns the ID of the source image, and retains the source image.  

  • false: allows image copy within the same region.

Tag syntax

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

Tag properties

Property

Type

Required

Editable

Description

Constraint

Key

String

No

No

The tag key.

The tag key must be 1 to 128 characters in length and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Value

String

No

No

The tag value.

The tag value can be up to 128 characters in length and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Return values

Fn::GetAtt

  • ImageId: the ID of the destination custom image.

  • DestinationRegionId: the ID of the destination region.

  • SourceRegionId: the ID of the source region.

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"
            ]
          }
        }
      }
    }