ALIYUN::ECS::ImagePipeline

ALIYUN::ECS::ImagePipeline类型用于创建一个镜像模板。

语法

{
  "Type": "ALIYUN::ECS::ImagePipeline",
  "Properties": {
    "BaseImageType": String,
    "Description": String,
    "ResourceGroupId": String,
    "SystemDiskSize": Integer,
    "VSwitchId": String,
    "AddAccount": List,
    "Name": String,
    "ExecutePipeline": Boolean,
    "DeleteInstanceOnFailure": Boolean,
    "ImageName": String,
    "ToRegionId": List,
    "InternetMaxBandwidthOut": Integer,
    "InstanceType": String,
    "Tags": List,
    "BuildContent": String,
    "BaseImage": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

BaseImageType

String

源镜像类型。

取值:

  • IMAGE:镜像。

  • IMAGE_FAMILY:镜像族系。

Description

String

描述信息。

长度为2~256个英文或中文字符,不能以http://https://开头。

ResourceGroupId

String

资源组ID。

SystemDiskSize

Integer

中转实例的系统盘大小。

单位:GiB。

取值范围:20~500。

默认值:40。

VSwitchId

String

VPC的交换机ID。

不设置参数值时,默认创建新的VPC与交换机,请确保您账号下VPC资源配额充足,更多信息,请参见限制与配额

AddAccount

List

目标镜像共享的阿里云账号ID。

最多支持20个。

Name

String

模板名称。

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

说明

不设置Name时,默认使用ImagePipelineId返回值。

ExecutePipeline

Boolean

是否执行构建镜像的任务。

取值:

  • true(默认值):执行构建镜像的任务。

  • false:不执行构建镜像的任务。

DeleteInstanceOnFailure

Boolean

镜像构建失败后是否释放中转实例。

取值:

  • true(默认值):释放中转实例。

  • false:不释放中转实例。

说明

中转实例如果没有成功启动,则实例默认不保留。

ImageName

String

目标镜像名称前缀。

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

最终完整的镜像名称由系统自动拼接名称前缀与构建任务ID(ExecutionId),格式为{ImageName}_{ExecutionId}

ToRegionId

List

目标镜像待分发的地域列表。

最多支持20个,不设置参数值时,默认只在当前地域创建镜像。

InternetMaxBandwidthOut

Integer

中转实例的公网出带宽大小。

单位:Mbit/s。

取值范围:0~100。

默认值:0。

InstanceType

String

实例规格。

您可以调用DescribeInstanceTypes查询不同的实例规格。

不设置参数值时,默认按vCPU和内存最小的原则,自动设置实例规格,并受实例规格的库存影响。

例如,默认选择ecs.g6.large实例规格,如果库存不足,将选择ecs.g6.xlarge实例规格。

Tags

List

标签列表。

最多支持20个标签,更多信息,请参见Tags属性

BuildContent

String

镜像模板内容。

内容大小不能超过16KB,最大支持127个命令。

BaseImage

String

源镜像。

BaseImageType=IMAGE时,该参数取值为镜像ID。

BaseImageType=IMAGE_FAMILY时,该参数取值为镜像族系名称。

Tags语法

"Tags": [
  {
    "Value": String,
    "Key": String
  }
]

Tags属性

属性名称

类型

必须

允许更新

描述

约束

Value

String

标签值。

一旦传入该值,可以为空字符串。最多支持128个字符,不能以acs:开头,不能包含http://或者https://

Key

String

标签键。

一旦传入该值,则不允许为空字符串。最多支持128个字符,不能以aliyunacs:开头,不能包含http://或者https://

返回值

Fn::GetAtt

ImagePipelineId:镜像模板ID。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      AddAccount:
        AssociationProperty: List[Parameter]
        AssociationPropertyMetadata:
          Parameter:
            Description:
              en: The ID of Ali account.
            Required: false
            Type: String
        Description:
          en: The IDs of Alibaba Cloud accounts to which to share the image that will
            be created based on the image template. You can specify up to 20 account IDs.
        MaxLength: 20
        Required: false
        Type: Json
      BaseImage:
        Description:
          en: 'The source image.
    
            If you set BaseImageType to IMAGE, set the BaseImage parameter to the ID of
            a custom image.
    
            If you set BaseImageType to IMAGE_FAMILY, set the BaseImage parameter to the
            name of an image family.'
        Required: true
        Type: String
      BaseImageType:
        AllowedValues:
        - IMAGE
        - IMAGE_FAMILY
        Description:
          en: 'The type of the source image. Valid values:
    
            IMAGE: image
    
            IMAGE_FAMILY: image family'
        Required: true
        Type: String
      BuildContent:
        Description:
          en: The content of the image template. The content cannot exceed 16 KB in size
            and can contain up to 127 commands. For more information about the commands
            that are supported, see the "Usage notes" section of this topic.
        Required: false
        Type: String
      DeleteInstanceOnFailure:
        Description:
          en: 'Specifies whether to release the intermediate instance when the image cannot
            be created. Valid values:
    
            true
    
            false
    
            Default value: true.
    
            Note If the intermediate instance cannot be started, the instance is released
            by default.'
        Required: false
        Type: Boolean
      Description:
        AssociationProperty: TextArea
        Description:
          en: The description of the image template. The description must be 2 to 256
            characters in length. It cannot start with http:// or https://.
        Required: false
        Type: String
      ExecutePipeline:
        Default: true
        Description:
          en: Whether execute pipeline. Default value is true
        Required: false
        Type: Boolean
      ImageName:
        Description:
          en: 'The prefix of the image name. The prefix must be 2 to 64 characters in
            length. It must start with a letter and cannot start with http:// or https://.
            It can contain letters, digits, colons (:), underscores (_), periods (.),
            and hyphens (-).
    
            The system generates the final complete image name that consists of the specified
            prefix and the ID of the build task (ExecutionId) in the format of {ImageName}_{ExecutionId}.'
        Required: false
        Type: String
      InstanceType:
        Description:
          en: 'The instance type. You can call the  DescribeInstanceTypes  to query instance
            types.
    
            If you do not configure this parameter, an instance type that provides the
            fewest vCPUs and memory resources is automatically selected. This configuration
            is subject to resource availability of instance types. For example, the ecs.g6.large
            instance type is automatically selected. If available ecs.g6.large resources
            are insufficient, the ecs.g6.xlarge instance type is selected.'
        Required: false
        Type: String
      InternetMaxBandwidthOut:
        Description:
          en: 'The size of the outbound public bandwidth for the intermediate instance.
            Unit: Mbit/s. Valid values: 0 to 100.
    
            Default value: 0.'
        Required: false
        Type: Number
      Name:
        Description:
          en: 'The name of the image template. The name must be 2 to 128 characters in
            length. It must start with a letter and cannot start with http:// or https://.
            It can contain letters, digits, colons (:), underscores (_), periods (.),
            and hyphens (-).
    
            Note If you do not specify the Name parameter, the return value of ImagePipelineId
            is used.'
        Required: false
        Type: String
      ResourceGroupId:
        AssociationProperty: ALIYUN::ECS::ResourceGroup::ResourceGroupId
        Description:
          en: The ID of the resource group.
        Required: false
        Type: String
      SystemDiskSize:
        Description:
          en: 'The system disk size of the intermediate instance. Unit: GiB. Valid values:
            20 to 500.
    
            Default value: 40.'
        Required: false
        Type: Number
      Tags:
        AssociationProperty: List[Parameters]
        AssociationPropertyMetadata:
          ListMetadata:
            Order:
            - Key
            - Value
          Parameters:
            Key:
              Description:
                en: 'The key of tag N to add to the capacity reservation. Valid values
                  of N: 1 to 20. The tag key cannot be an empty string. The tag key can
                  be up to 128 characters in length and cannot contain http:// or https://.
                  It cannot start with acs: or aliyun.'
              Required: false
              Type: String
            Value:
              Description:
                en: 'The value of tag N to add to the capacity reservation. Valid values
                  of N: 1 to 20. The tag value can be an empty string. The tag value can
                  be up to 128 characters in length and cannot start with acs:. The tag
                  value cannot contain http:// or https://.'
              Required: false
              Type: String
        MaxLength: 20
        Required: false
        Type: Json
      ToRegionId:
        AssociationProperty: List[Parameter]
        AssociationPropertyMetadata:
          Parameter:
            Description:
              en: The region ID.
            Required: false
            Type: String
        Description:
          en: 'The IDs of regions to which you want to distribute the image that is created
            based on the image template. You can specify up to 20 region IDs.
    
            If you do not specify this parameter, the image is created only in the current
            region.'
        MaxLength: 20
        Required: false
        Type: Json
      VSwitchId:
        AssociationProperty: ALIYUN::VPC::VSwitch::VSwitchId
        AssociationPropertyMetadata:
          VpcId: ${VpcId}
          ZoneId: ${ZoneId}
        Description:
          en: 'The ID of the vSwitch.
    
            If you do not specify this parameter, a new VPC and vSwitch are created. Make
            sure that the VPC quota in your account is sufficient. For more information,
            see Limits and quotas.'
        Required: false
        Type: String
    Resources:
      ImagePipeline:
        Properties:
          AddAccount:
            Ref: AddAccount
          BaseImage:
            Ref: BaseImage
          BaseImageType:
            Ref: BaseImageType
          BuildContent:
            Ref: BuildContent
          DeleteInstanceOnFailure:
            Ref: DeleteInstanceOnFailure
          Description:
            Ref: Description
          ExecutePipeline:
            Ref: ExecutePipeline
          ImageName:
            Ref: ImageName
          InstanceType:
            Ref: InstanceType
          InternetMaxBandwidthOut:
            Ref: InternetMaxBandwidthOut
          Name:
            Ref: Name
          ResourceGroupId:
            Ref: ResourceGroupId
          SystemDiskSize:
            Ref: SystemDiskSize
          Tags:
            Ref: Tags
          ToRegionId:
            Ref: ToRegionId
          VSwitchId:
            Ref: VSwitchId
        Type: ALIYUN::ECS::ImagePipeline
    Outputs:
      ImagePipelineId:
        Description: The ID of the image template.
        Value:
          Fn::GetAtt:
          - ImagePipeline
          - ImagePipelineId
                            
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "BaseImageType": {
          "Type": "String",
          "Description": {
            "en": "The type of the source image. Valid values:\nIMAGE: image\nIMAGE_FAMILY: image family"
          },
          "AllowedValues": [
            "IMAGE",
            "IMAGE_FAMILY"
          ],
          "Required": true
        },
        "Description": {
          "AssociationProperty": "TextArea",
          "Type": "String",
          "Description": {
            "en": "The description of the image template. The description must be 2 to 256 characters in length. It cannot start with http:// or https://."
          },
          "Required": false
        },
        "ResourceGroupId": {
          "AssociationProperty": "ALIYUN::ECS::ResourceGroup::ResourceGroupId",
          "Type": "String",
          "Description": {
            "en": "The ID of the resource group."
          },
          "Required": false
        },
        "SystemDiskSize": {
          "Type": "Number",
          "Description": {
            "en": "The system disk size of the intermediate instance. Unit: GiB. Valid values: 20 to 500.\nDefault value: 40."
          },
          "Required": false
        },
        "VSwitchId": {
          "AssociationPropertyMetadata": {
            "VpcId": "${VpcId}",
            "ZoneId": "${ZoneId}"
          },
          "AssociationProperty": "ALIYUN::VPC::VSwitch::VSwitchId",
          "Type": "String",
          "Description": {
            "en": "The ID of the vSwitch.\nIf you do not specify this parameter, a new VPC and vSwitch are created. Make sure that the VPC quota in your account is sufficient. For more information, see Limits and quotas."
          },
          "Required": false
        },
        "AddAccount": {
          "AssociationPropertyMetadata": {
            "Parameter": {
              "Type": "String",
              "Description": {
                "en": "The ID of Ali account."
              },
              "Required": false
            }
          },
          "AssociationProperty": "List[Parameter]",
          "Type": "Json",
          "Description": {
            "en": "The IDs of Alibaba Cloud accounts to which to share the image that will be created based on the image template. You can specify up to 20 account IDs."
          },
          "Required": false,
          "MaxLength": 20
        },
        "Name": {
          "Type": "String",
          "Description": {
            "en": "The name of the image template. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.), and hyphens (-).\nNote If you do not specify the Name parameter, the return value of ImagePipelineId is used."
          },
          "Required": false
        },
        "ExecutePipeline": {
          "Type": "Boolean",
          "Description": {
            "en": "Whether execute pipeline. Default value is true"
          },
          "Required": false,
          "Default": true
        },
        "DeleteInstanceOnFailure": {
          "Type": "Boolean",
          "Description": {
            "en": "Specifies whether to release the intermediate instance when the image cannot be created. Valid values:\ntrue\nfalse\nDefault value: true.\nNote If the intermediate instance cannot be started, the instance is released by default."
          },
          "Required": false
        },
        "ImageName": {
          "Type": "String",
          "Description": {
            "en": "The prefix of the image name. The prefix must be 2 to 64 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.), and hyphens (-).\nThe system generates the final complete image name that consists of the specified prefix and the ID of the build task (ExecutionId) in the format of {ImageName}_{ExecutionId}."
          },
          "Required": false
        },
        "ToRegionId": {
          "AssociationPropertyMetadata": {
            "Parameter": {
              "Type": "String",
              "Description": {
                "en": "The region ID."
              },
              "Required": false
            }
          },
          "AssociationProperty": "List[Parameter]",
          "Type": "Json",
          "Description": {
            "en": "The IDs of regions to which you want to distribute the image that is created based on the image template. You can specify up to 20 region IDs.\nIf you do not specify this parameter, the image is created only in the current region."
          },
          "Required": false,
          "MaxLength": 20
        },
        "InternetMaxBandwidthOut": {
          "Type": "Number",
          "Description": {
            "en": "The size of the outbound public bandwidth for the intermediate instance. Unit: Mbit/s. Valid values: 0 to 100.\nDefault value: 0."
          },
          "Required": false
        },
        "InstanceType": {
          "Type": "String",
          "Description": {
            "en": "The instance type. You can call the  DescribeInstanceTypes  to query instance types.\nIf you do not configure this parameter, an instance type that provides the fewest vCPUs and memory resources is automatically selected. This configuration is subject to resource availability of instance types. For example, the ecs.g6.large instance type is automatically selected. If available ecs.g6.large resources are insufficient, the ecs.g6.xlarge instance type is selected."
          },
          "Required": false
        },
        "Tags": {
          "AssociationPropertyMetadata": {
            "Parameters": {
              "Value": {
                "Type": "String",
                "Description": {
                  "en": "The value of tag N to add to the capacity reservation. Valid values of N: 1 to 20. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot start with acs:. The tag value cannot contain http:// or https://."
                },
                "Required": false
              },
              "Key": {
                "Type": "String",
                "Description": {
                  "en": "The key of tag N to add to the capacity reservation. Valid values of N: 1 to 20. The tag key cannot be an empty string. The tag key can be up to 128 characters in length and cannot contain http:// or https://. It cannot start with acs: or aliyun."
                },
                "Required": false
              }
            },
            "ListMetadata": {
              "Order": [
                "Key",
                "Value"
              ]
            }
          },
          "AssociationProperty": "List[Parameters]",
          "Type": "Json",
          "Required": false,
          "MaxLength": 20
        },
        "BuildContent": {
          "Type": "String",
          "Description": {
            "en": "The content of the image template. The content cannot exceed 16 KB in size and can contain up to 127 commands. For more information about the commands that are supported, see the \"Usage notes\" section of this topic."
          },
          "Required": false
        },
        "BaseImage": {
          "Type": "String",
          "Description": {
            "en": "The source image.\nIf you set BaseImageType to IMAGE, set the BaseImage parameter to the ID of a custom image.\nIf you set BaseImageType to IMAGE_FAMILY, set the BaseImage parameter to the name of an image family."
          },
          "Required": true
        }
      },
      "Resources": {
        "ImagePipeline": {
          "Type": "ALIYUN::ECS::ImagePipeline",
          "Properties": {
            "BaseImageType": {
              "Ref": "BaseImageType"
            },
            "Description": {
              "Ref": "Description"
            },
            "ResourceGroupId": {
              "Ref": "ResourceGroupId"
            },
            "SystemDiskSize": {
              "Ref": "SystemDiskSize"
            },
            "VSwitchId": {
              "Ref": "VSwitchId"
            },
            "AddAccount": {
              "Ref": "AddAccount"
            },
            "Name": {
              "Ref": "Name"
            },
            "ExecutePipeline": {
              "Ref": "ExecutePipeline"
            },
            "DeleteInstanceOnFailure": {
              "Ref": "DeleteInstanceOnFailure"
            },
            "ImageName": {
              "Ref": "ImageName"
            },
            "ToRegionId": {
              "Ref": "ToRegionId"
            },
            "InternetMaxBandwidthOut": {
              "Ref": "InternetMaxBandwidthOut"
            },
            "InstanceType": {
              "Ref": "InstanceType"
            },
            "Tags": {
              "Ref": "Tags"
            },
            "BuildContent": {
              "Ref": "BuildContent"
            },
            "BaseImage": {
              "Ref": "BaseImage"
            }
          }
        }
      },
      "Outputs": {
        "ImagePipelineId": {
          "Description": "The ID of the image template.",
          "Value": {
            "Fn::GetAtt": [
              "ImagePipeline",
              "ImagePipelineId"
            ]
          }
        }
      }
    }