ALIYUN::ECS::DiskAttachment is used to attach a disk to an ECS instance.
Syntax
{
"Type": "ALIYUN::ECS::DiskAttachment",
"Properties": {
"InstanceId": String,
"Device": String,
"DeleteWithInstance": Boolean,
"DiskId": String,
"DeleteAutoSnapshot": Boolean
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
InstanceId | String | Yes | No | The ID of the ECS instance to which you want to attach the disk. | None |
DiskId | String | Yes | No | The ID of the disk. | The disk and ECS instance must reside within the same zone. |
Device | String | No | No | The device name of the disk. | If you do not set this parameter, the system automatically allocates a device name in alphabetical order from /dev/xvdb to /dev/xvdz. |
DeleteWithInstance | Boolean | No | No | Specifies whether to release the disk together with the instance. | Valid values:
|
DeleteAutoSnapshot | Boolean | No | No | Specifies whether to delete automatic snapshots of the disk when the disk is released. | Default value: true. Valid values:
|
Response parameters
Fn::GetAtt
- DiskId: the ID of the created disk.
- Status: the status of the created disk.
- Device: the device name of the created disk.
Examples
JSON
format{ "ROSTemplateFormatVersion": "2015-09-01", "Parameters": { "InstanceId": { "Type": "String", "AssociationProperty": "ALIYUN::ECS::Instance::InstanceId" }, "DiskId": { "Type": "String", "AssociationProperty": "ALIYUN::ECS::Disk::DiskId" } }, "Resources": { "DiskAttachment": { "Type": "ALIYUN::ECS::DiskAttachment", "Properties": { "InstanceId": { "Ref": "InstanceId" }, "Device": "/dev/xvda", "DiskId": { "Ref": "DiskId" } } } }, "Outputs": { "Status": { "Description": "The disk status now.", "Value": { "Fn::GetAtt": [ "DiskAttachment", "Status" ] } }, "Device": { "Description": "The device where the volume is exposed on ecs instance.", "Value": { "Fn::GetAtt": [ "DiskAttachment", "Device" ] } }, "DiskId": { "Description": "The disk id of created disk", "Value": { "Fn::GetAtt": [ "DiskAttachment", "DiskId" ] } } } }