ALIYUN::ECS::DiskAttachment用于掛載ECS磁盤。
語法
{
"Type": "ALIYUN::ECS::DiskAttachment",
"Properties": {
"InstanceId": String,
"Device": String,
"DeleteWithInstance": Boolean,
"DiskId": String,
"DeleteAutoSnapshot": Boolean
}
}
屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
---|---|---|---|---|---|
InstanceId | String | 是 | 否 | 需掛載磁盤的實例ID | 無 |
DiskId | String | 是 | 否 | 磁盤ID | 磁盤和ECS實例必須在同一個可用區。 |
Device | String | 否 | 否 | 磁盤設備名 | 如不指定,則默認由系統按順序分配,即從 /dev/xvdb 到 /dev/xvdz。 |
DeleteWithInstance | Boolean | 否 | 否 | 磁盤是否隨實例釋放 | 取值:
|
DeleteAutoSnapshot | Boolean | 否 | 否 | 刪除磁盤時是否刪除自動快照 | 取值:
|
返回值
Fn::GetAtt
- DiskId:新建磁盤的ID。
- Status:新建磁盤的狀態。
- Device:磁盤設備名。
示例
JSON
格式{ "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" ] } } } }