Creates 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,
"Features": Map,
"SourceRegionId": String,
"DetectionStrategy": String,
"ImageVersion": String,
"BootMode": String
}
}
Properties
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
Description |
String |
No |
No |
The image description. |
The description must be 2 to 256 characters in length. It cannot start with |
|
InstanceId |
String |
No |
No |
The instance ID. |
Uses an ECS instance to create the image. For more information, see Create a custom image from an instance. |
|
ImageName |
String |
No |
No |
The image name. |
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 |
|
SnapshotId |
String |
No |
No |
The snapshot ID. |
Uses a snapshot to create the 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 resource group ID. |
None. |
|
Platform |
String |
No |
No |
The OS distribution for the system disk. Required when creating a system disk from a data disk snapshot. |
Valid values:
|
|
Features |
Map |
No |
No |
The image feature attributes. |
|
|
DiskDeviceMapping |
List |
No |
No |
The disk-to-snapshot mappings. |
For more information, see DiskDeviceMapping properties. |
|
Architecture |
String |
No |
No |
The system architecture. Required when creating a system disk from a data disk snapshot. |
Valid values:
|
|
ImageFamily |
String |
No |
No |
The image family name. |
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 |
|
SourceRegionId |
String |
No |
No |
The region ID of the source instance or snapshot. |
By default, the ID of the current region is used. |
|
DetectionStrategy |
String |
No |
No |
The image check mode. |
If not specified, no check is performed. Only 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 Scan and fix custom images and Operating system limits for image check. |
|
ImageVersion |
String |
No |
No |
The image version. |
If InstanceId references an instance whose image is from Alibaba Cloud Marketplace or derived from one, leave this empty or set it to the instance image version. |
|
BootMode |
String |
No |
No |
The image boot mode. |
Valid values:
Note
Ensure the specified boot mode is supported by the image. An unsupported boot mode prevents instances from starting. |
Features syntax
"Features":
{
"ImdsSupport": String
}
Features property
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
ImdsSupport |
String |
No |
No |
The image metadata access mode. |
Valid values:
|
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 |
|
Value |
String |
No |
No |
The tag value. |
The tag value can be up to 128 characters in length, and cannot contain |
DiskDeviceMapping syntax
"DiskDeviceMapping": [
{
"Device": String,
"SnapshotId": String,
"Size": Integer,
"DiskType": String
}
]
DiskDeviceMapping properties
|
Property |
Type |
Required |
Editable |
Description |
Constraint |
|
Device |
String |
No |
No |
The disk device name. |
Valid values:
|
|
SnapshotId |
String |
No |
No |
The snapshot ID. |
None. |
|
Size |
Integer |
No |
No |
The disk size. |
Unit: GiB. |
|
DiskType |
String |
No |
No |
The disk type. |
Creates a system disk from a data disk snapshot. If not specified, uses the snapshot disk type. 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
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{
"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"
]
}
}
}
} More examples: custom-image.yml. These examples use ALIYUN::ECS::CustomImage and ALIYUN::ECS::CopyImage.