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:
  • true: releases the disk when the instance is released.
  • false: retains the disk when the instance is released.
DeleteAutoSnapshot Boolean No No Specifies whether to delete automatic snapshots of the disk when the disk is released. Default value: true. Valid values:
  • true:
  • false

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"
        ]
      }
    }
  }
}