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
}
}
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 and cannot start with http:// or https:// . |
InstanceId | String | No | No | The ID of the instance. | If you set 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. The name must start with a letter but cannot start with http:// or https:// . The name can contain letters, digits, underscores (_), and hyphens (-). |
SnapshotId | String | No | No | The ID of the snapshot. | If you set 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 of the custom image. | 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 in the custom image. 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. | Default value: Others Linux. Valid values:
|
DiskDeviceMapping | List | No | No | The mappings between images and snapshots. | 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. | Default value: x86_64. Valid values:
|
ImageFamily | String | No | No | The name of the custom image family. | 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 acs: or aliyun . The name 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. |
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:// . The tag key cannot start with acs: or aliyun . |
Value | String | No | No | The tag value. | The tag value must be 0 to 128 characters in length, and cannot contain http:// or https:// . The tag value cannot start with acs: or aliyun . |
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:
|
SnapshotId | String | No | No | The ID of the snapshot. | None |
Size | Integer | No | No | The size of the disk. | Valid values:
Unit: GiB. |
DiskType | String | No | No | The type of the disk in the custom image. | You can set this property to create the system disk for the custom image from a data disk snapshot. If you do not set this property, the disk type varies based on the snapshot that is used. Valid values:
|
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
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" ] } } } }
To view more examples, visit CustomImage.json and CustomImage.yml. In the examples, the ALIYUN::ECS::CopyImage and ALIYUN::ECS::CustomImage resource types are used.