All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::CustomImage

Last Updated:Jan 09, 2024

ALIYUN::ECS::CustomImage is used to create a custom image.

Syntax

{
  "Type": "ALIYUN::ECS::CustomImage",
  "Properties": {
    "Description": String,
    "InstanceId": String,
    "ImageName": String,
    "SnapshotId": String,
    "Tag": List,
    "ResourceGroupId": String,
    "Platform": String,
    "DiskDeviceMapping": List,
    "Architecture": String,
    "ImageFamily": String,
    "SourceRegionId": String,
    "DetectionStrategy": String,
    "ImageVersion": String,
    "BootMode": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

Description

String

No

No

The description of the custom image.

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

InstanceId

String

No

No

The instance ID.

If you specify this property, an Elastic Compute Service (ECS) instance is used to create the custom image. For more information, see Create a custom image from an instance.

ImageName

String

No

No

The name of the custom image.

The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.

SnapshotId

String

No

No

The snapshot ID.

If you specify this property, a snapshot is used to create the custom image. For more information, see Create a custom image from a snapshot.

Tag

List

No

No

The tags.

For more information, see Tag properties.

ResourceGroupId

String

No

Yes

The ID of the resource group to which the custom image belongs.

None.

Platform

String

No

No

The distribution of the OS for the system disk. If you specify a data disk snapshot to create the system disk of the custom image, you must use the Platform property to specify the distribution of the OS for the system disk.

Valid values:

  • CentOS

  • Ubuntu

  • SUSE

  • OpenSUSE

  • RedHat

  • Debian

  • CoreOS

  • Aliyun

  • Windows Server 2012

  • Windows 7

  • Customized Linux

  • Others Linux (default)

DiskDeviceMapping

List

No

No

The mappings between the custom image and the snapshot.

For more information, see DiskDeviceMapping properties.

Architecture

String

No

No

The system architecture of the system disk. If you specify a data disk snapshot to create the system disk of the custom image, you must use the Architecture property to specify the system architecture of the system disk.

Valid values:

  • i386

  • x86_64 (default)

ImageFamily

String

No

No

The name of the image family.

The name must be 2 to 128 characters in length, and can contain letters, digits, colons(:), underscores (_), and hyphens (-). It must start with a letter and cannot start with aliyun or acs:. It cannot contain http:// or https://.

SourceRegionId

String

No

No

The ID of the region to which the instance or snapshot belongs.

By default, the ID of the current region is used.

DetectionStrategy

String

No

No

The mode that you want to use to check the custom image.

If you do not specify this property, the custom image is not checked. Only the standard check mode is supported.

Note

Most Linux and Windows distributions are supported. For more information about the check items and the OS limits for image checks, see Overview and Operating system limits for image check.

ImageVersion

String

No

No

The version of the custom image.

If you specify InstanceId and the image of the instance is an Alibaba Cloud Marketplace image or a custom image created from an Alibaba Cloud Marketplace image, you must leave ImageVersion empty or set ImageVersion to the image version of the instance.

BootMode

String

No

No

The boot mode of the custom image.

Valid values:

  • BIOS: Basic Input/Output System (BIOS) boot mode

  • UEFI: Unified Extensible Firmware Interface (UEFI) boot mode

Note

You must familiarize yourself with the boot modes that are supported by the specified image. When you use this property to change the boot mode of the image, you must specify a supported boot mode for the image. This way, instances that use the image can be started as expected.

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:.

DiskDeviceMapping syntax

"DiskDeviceMapping": [
  {
    "Device": String,
    "SnapshotId": String,
    "Size": Integer,
    "DiskType": String
  }
]

DiskDeviceMapping properties

Property

Type

Required

Editable

Description

Constraint

Device

String

No

No

The device name of the disk in the custom image.

Valid values:

  • For basic disks, the valid values range from /dev/xvda to /dev/xvdz in alphabetical order.

  • For disk categories other than basic disks, the valid values range from /dev/vda to /dev/vdz in alphabetical order.

SnapshotId

String

No

No

The snapshot ID.

None.

Size

Integer

No

No

The disk size.

  • If you leave SnapshotId empty, the following valid values are supported for Size:

    • Valid values for basic disks: 5 to 2000.

      Default value: 5.

    • Valid values for disk categories other than basic disks: 20 to 32768.

      Default value: 20.

  • If you specify SnapshotId, the value of Size must be greater than or equal to the value of SnapshotId. The default value of Size is the same as the default value of SnapshotId.

Unit: GiB.

DiskType

String

No

No

The type of the disk in the custom image.

You can use this property to create the system disk of the custom image from a data disk snapshot. If you leave this property empty, the disk type of the snapshot is used.

Valid values:

  • system: system disk

  • data: data disk

Return values

Fn::GetAtt

ImageId: the ID of the custom image.

SourceRegionId: the ID of the region to which the instance or snapshot belongs.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Description:
       
      en: Create ECS Custom Image
    Parameters:
      InstanceId:
        Type: String
        AssociationProperty: ALIYUN::ECS::Instance::InstanceId
    Resources:
      CustomImage:
        Type: ALIYUN::ECS::CustomImage
        Properties:
          InstanceId:
            Ref: InstanceId
          ImageName: myImageName
    Outputs:
      ImageId:
        Value:
          Fn::GetAtt:
            - CustomImage
            - ImageId
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Description": {
         
        "en": "Create ECS Custom Image"
      },
      "Parameters": {
        "InstanceId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::ECS::Instance::InstanceId"
        }
      },
      "Resources": {
        "CustomImage": {
          "Type": "ALIYUN::ECS::CustomImage",
          "Properties": {
            "InstanceId": {
              "Ref": "InstanceId"
            },
            "ImageName": "myImageName"
          }
        }
      },
      "Outputs": {
        "ImageId": {
          "Value": {
            "Fn::GetAtt": [
              "CustomImage",
              "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.