ALIYUN::ECS::DiskAttachment is used to attach a disk to an Elastic Compute Service (ECS) instance.
Syntax
{
"Type": "ALIYUN::ECS::DiskAttachment",
"Properties": {
"InstanceId": String,
"Device": String,
"DeleteWithInstance": Boolean,
"DiskId": String,
"DeleteAutoSnapshot": Boolean,
"Password": String,
"InstanceType": String,
"Force": Boolean,
"KeyPairName": String,
"Bootable": 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 in the same zone. |
Device | String | No | No | The device name of the disk. | If you do not specify this property, 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 when the instance is released. | Valid values:
|
Password | String | No | No | The password that is set for the instance when you attach the system disk. | The password is applicable only to the administrator and root users. The password must be 8 to 30 characters in length, and must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The following characters are supported: For a Windows instance, the password cannot start with a forward slash (/). |
Force | Boolean | No | No | Specifies whether to forcefully attach the disk to the instance. | Valid values:
Default value: false. |
KeyPairName | String | No | No | The name of the SSH key pair that you bind to the ECS Linux instance when you attach the system disk. |
|
InstanceType | String | No | No | The instance type. | Valid values:
|
Bootable | Boolean | No | No | Specifies whether to attach the disk as a system disk. | Valid values:
Default value: false. |
DeleteAutoSnapshot | Boolean | No | No | Specifies whether to delete automatic snapshots of the disk when the disk is released. | Default value: true. Valid values:
|
Return values
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
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 {
"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"
]
}
}
}
}