全部产品
Search
文档中心

资源编排:ALIYUN::ENS::DiskInstanceAttachment

更新时间:Feb 06, 2024

ALIYUN::ENS::DiskInstanceAttachment类型用于为ENS实例挂载数据盘。

语法

{
  "Type": "ALIYUN::ENS::DiskInstanceAttachment",
  "Properties": {
    "InstanceId": String,
    "DeleteWithInstance": String,
    "DiskId": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

InstanceId

String

实例ID。

DeleteWithInstance

String

待挂载的云盘是否随实例释放。

取值:

  • true:释放实例时,该云盘随实例一起释放。

  • false:释放实例时,保留该云盘,不随实例一起释放。

  • 为空则表示默认为 false。

DiskId

String

待挂载的云盘ID。

云盘(DiskId)和实例(InstanceId)必须在同一个节点。

返回值

Fn::GetAtt

  • InstanceId:实例ID。

  • DiskId:挂载的云盘ID。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      DeleteWithInstance:
        Description:
          en: "Whether the cloud disk to be mounted is released with the instance\nValue:\n\
            true: When the instance is released, the cloud disk is released together with\
            \ the instance.\nfalse: When the instance is released, the cloud disk is retained\
            \ and is not released together with the instance.\n Empty means false by default."
        Required: false
        Type: String
      DiskId:
        Description:
          en: The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the
            instance (InstanceId) must be on the same node.
        Required: true
        Type: String
      InstanceId:
        Description:
          en: Instance ID.
        Required: true
        Type: String
    Resources:
      ExtensionResource:
        Properties:
          DeleteWithInstance:
            Ref: DeleteWithInstance
          DiskId:
            Ref: DiskId
          InstanceId:
            Ref: InstanceId
        Type: ALIYUN::ENS::DiskInstanceAttachment
    Outputs:
      DiskId:
        Description: The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and
          the instance (InstanceId) must be on the same node.
        Value:
          Fn::GetAtt:
          - ExtensionResource
          - DiskId
      InstanceId:
        Description: Instance ID.
        Value:
          Fn::GetAtt:
          - ExtensionResource
          - InstanceId                 
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "InstanceId": {
          "Type": "String",
          "Description": {
            "en": "Instance ID."
          },
          "Required": true
        },
        "DeleteWithInstance": {
          "Type": "String",
          "Description": {
            "en": "Whether the cloud disk to be mounted is released with the instance\nValue:\ntrue: When the instance is released, the cloud disk is released together with the instance.\nfalse: When the instance is released, the cloud disk is retained and is not released together with the instance.\n Empty means false by default."
          },
          "Required": false
        },
        "DiskId": {
          "Type": "String",
          "Description": {
            "en": "The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node."
          },
          "Required": true
        }
      },
      "Resources": {
        "ExtensionResource": {
          "Type": "ALIYUN::ENS::DiskInstanceAttachment",
          "Properties": {
            "InstanceId": {
              "Ref": "InstanceId"
            },
            "DeleteWithInstance": {
              "Ref": "DeleteWithInstance"
            },
            "DiskId": {
              "Ref": "DiskId"
            }
          }
        }
      },
      "Outputs": {
        "InstanceId": {
          "Description": "Instance ID.",
          "Value": {
            "Fn::GetAtt": [
              "ExtensionResource",
              "InstanceId"
            ]
          }
        },
        "DiskId": {
          "Description": "The ID of the cloud disk to be mounted. The Cloud Disk (DiskId) and the instance (InstanceId) must be on the same node.",
          "Value": {
            "Fn::GetAtt": [
              "ExtensionResource",
              "DiskId"
            ]
          }
        }
      }
    }