全部产品
Search
文档中心

资源编排:ALIYUN::ENS::Image

更新时间:Dec 02, 2024

ALIYUN::ENS::Image类型用于从所在实例创建一份镜像。

语法

{
  "Type": "ALIYUN::ENS::Image",
  "Properties": {
    "ImageName": String,
    "DeleteAfterImageUpload": Boolean,
    "InstanceId": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

ImageName

String

镜像名称。

长度为 2~128 个英文或中文字符。必须以大小写字母或中文开头,但不能以http://https://开头。可以包含数字、半角冒号(:)、下划线(_)或者连字符(-)。

DeleteAfterImageUpload

Boolean

镜像打包上传成功后是否自动释放实例。

取值:

  • true:释放实例时,该镜像随实例一起释放。

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

InstanceId

String

实例 ID。

返回值

Fn::GetAtt

  • ImageOwnerAlias:镜像来源。

  • ImageName:镜像名称。

  • SnapshotId:快照ID。

  • Platform:镜像所使用的操作系统类型。

  • Architecture:镜像系统架构类型。

  • ImageSize:镜像大小,单位:GiB。

  • InstanceId:实例 ID。

  • OsVersion:系统版本。

  • CreateTime:镜像创建时间。

  • ImageId:镜像ID。

  • ComputeType:计算属性

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  ImageName:
    Type: String
    Description:
      en: |-
        The name of the image. The name must be 2 to 128 characters in length. 
        The name can contain letters, digits, colons (:), underscores (_), and hyphens (-). 
        It must start with a letter but cannot start with http:// or https://. 
        The name can contain letters, digits, colons (:), underscores (_), and hyphens (-).
    Required: true
  InstanceId:
    Type: String
    Description:
      en: The ID of the instance corresponding to the image.
    Required: false
Resources:
  ExtensionResource:
    Type: ALIYUN::ENS::Image
    Properties:
      ImageName:
        Ref: ImageName
      InstanceId:
        Ref: InstanceId
Outputs:
  ImageOwnerAlias:
    Description: |-
      The source of the image. Valid values:
      system: public images
      self: your custom images
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ImageOwnerAlias
  ImageName:
    Description: The name of the image.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ImageName
  SnapshotId:
    Description: The ID of the snapshot corresponding to the image.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - SnapshotId
  Platform:
    Description: |-
      The type of operating system used by the image.
      centos
      ubuntu
      alios
      debian
      rhel
      windows
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Platform
  Architecture:
    Description: |-
      The image architecture. Valid values:
      i386
      x86_64
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Architecture
  ImageSize:
    Description: 'The size of the image. Unit: GiB.'
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ImageSize
  InstanceId:
    Description: The ID of the instance corresponding to the image.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - InstanceId
  OsVersion:
    Description: The operating system version.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - OsVersion
  CreateTime:
    Description: The image creation time. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - CreateTime
  ImageId:
    Description: The ID of the image.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ImageId
  ComputeType:
    Description: |-
      Computing type. ens_vm/ens: x86 computing.
       bare_metal: x86 bare machine or x86 bare metal. 
      arm_vm: ARM computing. 
      arm_bare_metal: ARM bare machine or ARM bare metal.
      pcfarm: heterogeneous computing.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ComputeType
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "ImageName": {
      "Type": "String",
      "Description": {
        "en": "The name of the image. The name must be 2 to 128 characters in length. \nThe name can contain letters, digits, colons (:), underscores (_), and hyphens (-). \nIt must start with a letter but cannot start with http:// or https://. \nThe name can contain letters, digits, colons (:), underscores (_), and hyphens (-)."
      },
      "Required": true
    },
    "InstanceId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the instance corresponding to the image."
      },
      "Required": false
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::ENS::Image",
      "Properties": {
        "ImageName": {
          "Ref": "ImageName"
        },
        "InstanceId": {
          "Ref": "InstanceId"
        }
      }
    }
  },
  "Outputs": {
    "ImageOwnerAlias": {
      "Description": "The source of the image. Valid values:\nsystem: public images\nself: your custom images",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ImageOwnerAlias"
        ]
      }
    },
    "ImageName": {
      "Description": "The name of the image.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ImageName"
        ]
      }
    },
    "SnapshotId": {
      "Description": "The ID of the snapshot corresponding to the image.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "SnapshotId"
        ]
      }
    },
    "Platform": {
      "Description": "The type of operating system used by the image.\ncentos\nubuntu\nalios\ndebian\nrhel\nwindows",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Platform"
        ]
      }
    },
    "Architecture": {
      "Description": "The image architecture. Valid values:\ni386\nx86_64",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Architecture"
        ]
      }
    },
    "ImageSize": {
      "Description": "The size of the image. Unit: GiB.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ImageSize"
        ]
      }
    },
    "InstanceId": {
      "Description": "The ID of the instance corresponding to the image.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "InstanceId"
        ]
      }
    },
    "OsVersion": {
      "Description": "The operating system version.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "OsVersion"
        ]
      }
    },
    "CreateTime": {
      "Description": "The image creation time. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "CreateTime"
        ]
      }
    },
    "ImageId": {
      "Description": "The ID of the image.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ImageId"
        ]
      }
    },
    "ComputeType": {
      "Description": "Computing type. ens_vm/ens: x86 computing.\n bare_metal: x86 bare machine or x86 bare metal. \narm_vm: ARM computing. \narm_bare_metal: ARM bare machine or ARM bare metal.\npcfarm: heterogeneous computing.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ComputeType"
        ]
      }
    }
  }
}