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 in the same zone.
Device String No No The device name of the disk. If you do not set this parameter, the system will automatically allocate a device name in alphabetical order from /dev/xvdb to /dev/xvdz.
DeleteWithInstance Boolean No No Specifies whether the disk is to be released together with the ECS instance. Valid values:
  • true: The disk will be released when the ECS instance is released.
  • false: The disk will be retained when the ECS instance is released.
DeleteAutoSnapshot Boolean No No Specifies whether automatic snapshots are deleted when the data disk is released. Valid values: true and false. Default value: true.

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

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "DiskAttachment": {
      "Type": "ALIYUN::ECS::DiskAttachment",
      "Properties": {
        "InstanceId": {
          "Ref": "InstanceId"
        },
        "Device": {
          "Ref": "Device"
        },
        "DeleteWithInstance": {
          "Ref": "DeleteWithInstance"
        },
        "DiskId": {
          "Ref": "DiskId"
        }
      }
    }
  },
  "Parameters": {
    "InstanceId": {
      "Type": "String",
      "Description": "The instanceId to attach the disk."
    },
    "Device": {
      "Type": "String",
      "Description": "The device where the volume is exposed on the instance. could be /dev/xvd[a-z]. If not specification, will use default value."
    },
    "DeleteWithInstance": {
      "Type": "Boolean",
      "Description": "If property is true, the disk will be deleted while instance is deleted, if property is false, the disk will be retain after instance is deleted.",
      "AllowedValues": [
        "True",
        "true",
        "False",
        "false"
      ]
    },
    "DiskId": {
      "Type": "String",
      "Description": "The disk id to attached."
    }
  },
  "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"
        ]
      }
    }
  }
}