全部产品
Search
文档中心

资源编排:ALIYUN::ECS::CapacityReservation

更新时间:Feb 06, 2024

ALIYUN::ECS::CapacityReservation类型用于创建容量预定服务。

语法

{
  "Type": "ALIYUN::ECS::CapacityReservation",
  "Properties": {
    "InstanceAmount": Integer,
    "Description": String,
    "PrivatePoolOptions": Map,
    "ZoneId": String,
    "ResourceGroupId": String,
    "EndTime": String,
    "EndTimeType": String,
    "InstanceType": String,
    "Tags": List
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

InstanceAmount

Integer

在一个实例规格内,需要预留的实例的总数量。

取值范围1~1000。

Description

String

容量预定服务的描述信息。

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

PrivatePoolOptions

Map

容量预定服务配置。

更多信息,请参考PrivatePoolOptions属性

ZoneId

String

容量预定服务所属地域下的可用区ID。

目前仅支持在一个可用区下创建容量预定服务。

ResourceGroupId

String

容量预定服务所在的企业资源组ID。

EndTime

String

容量预定服务的失效时间。

时间格式以ISO8601为标准,并需要使用UTC+0时间,格式为yyyy-MM-ddTHH:mm:ssZ。更多信息,请参见时间格式

EndTimeType

String

容量预定服务的失效方式。

取值:

  • Limited:指定时间释放。必须同时指定EndTime参数。

  • Unlimited:手动释放。不限制时间。

InstanceType

String

实例规格。

目前仅支持为一个实例规格设置容量预定服务。您可以调用DescribeInstanceTypes查询云服务器ECS提供的实例规格信息。

Tags

List

实例标签。

最多支持20个,更多信息请参考Tags属性

PrivatePoolOptions语法

"PrivatePoolOptions": {
  "MatchCriteria": String,
  "Name": String
}

PrivatePoolOptions属性

属性名称

类型

必须

允许更新

描述

约束

MatchCriteria

String

容量预定服务生效后生成的私有资源池的类型。

取值:

  • Open(默认值):开放模式。

  • Target:专用模式。

Name

String

容量预定服务的名称。

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

Tags语法

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

Tags属性

属性名称

类型

必须

允许更新

描述

约束

Value

String

容量预定服务的标签值。

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

Key

String

容量预定服务的标签键。

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

返回值

Fn::GetAtt

PrivatePoolOptionsId:容量预定服务ID。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      Description:
        AssociationProperty: TextArea
        Description:
          en: 'The description of the capacity reservation. The description must be 2
            to 256 characters in length and cannot start with http:// or https://.
    
            This parameter is empty by default.'
        Required: false
        Type: String
      EndTime:
        Description:
          en: The time when the capacity reservation expires. Specify the time in the
            ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in
            UTC. For more information, see ISO 8601.
        Required: false
        Type: String
      EndTimeType:
        AllowedValues:
        - Limited
        - Unlimited
        Description:
          en: 'The release mode of the capacity reservation. Valid values:
    
            Limited: The capacity reservation is automatically released at the specified
            time. If you specify this parameter, you must also specify the EndTime parameter.
    
            Unlimited: The capacity reservation must be manually released. You can release
            it anytime.'
        Required: false
        Type: String
      InstanceAmount:
        Description:
          en: The total number of instances for which to reserve capacity of an instance
            type.
        MaxValue: 1000
        MinValue: 1
        Required: true
        Type: Number
      InstanceType:
        Description:
          en: The instance type. A capacity reservation can be created to reserve the
            capacity of only a single instance type. You can call the DescribeInstanceTypes
            operation to query the instance types provided by ECS.
        Required: true
        Type: String
      PrivatePoolOptions:
        AssociationPropertyMetadata:
          Parameters:
            MatchCriteria:
              AllowedValues:
              - Open
              - Target
              Description:
                en: 'The type of the private pool to generate after the capacity reservation
                  takes effect. Valid values:
    
                  Open: open private pool
    
                  Target: targeted private pool
    
                  Default value: Open.'
              Required: false
              Type: String
            Name:
              Description:
                en: The name of the capacity reservation. The name must be 2 to 128 characters
                  in length. The description must start with a letter but cannot start
                  with http:// or https://. It can contain letters, digits, colons (:),
                  underscores (_), and hyphens (-).
              Required: false
              Type: String
        Required: false
        Type: Json
      ResourceGroupId:
        AssociationProperty: ALIYUN::ECS::ResourceGroup::ResourceGroupId
        Description:
          en: The ID of the resource group to which to assign the capacity reservation.
        Required: false
        Type: String
      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
      ZoneId:
        AssociationProperty: ZoneId
        Description:
          en: The ID of zone N within the region in which to create the capacity reservation.
            A capacity reservation can reserve resources within only a single zone.
        Required: true
        Type: String
    Resources:
      CapacityReservation:
        Properties:
          Description:
            Ref: Description
          EndTime:
            Ref: EndTime
          EndTimeType:
            Ref: EndTimeType
          InstanceAmount:
            Ref: InstanceAmount
          InstanceType:
            Ref: InstanceType
          PrivatePoolOptions:
            Ref: PrivatePoolOptions
          ResourceGroupId:
            Ref: ResourceGroupId
          Tags:
            Ref: Tags
          ZoneId:
            Ref: ZoneId
        Type: ALIYUN::ECS::CapacityReservation
    Outputs:
      PrivatePoolOptionsId:
        Description: The ID of the capacity reservation.
        Value:
          Fn::GetAtt:
          - CapacityReservation
          - PrivatePoolOptionsId
                            
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "Description": {
          "AssociationProperty": "TextArea",
          "Type": "String",
          "Description": {
            "en": "The description of the capacity reservation. The description must be 2 to 256 characters in length and cannot start with http:// or https://.\nThis parameter is empty by default."
          },
          "Required": false
        },
        "InstanceAmount": {
          "Type": "Number",
          "Description": {
            "en": "The total number of instances for which to reserve capacity of an instance type."
          },
          "Required": true,
          "MinValue": 1,
          "MaxValue": 1000
        },
        "EndTime": {
          "Type": "String",
          "Description": {
            "en": "The time when the capacity reservation expires. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. For more information, see ISO 8601."
          },
          "Required": false
        },
        "PrivatePoolOptions": {
          "AssociationPropertyMetadata": {
            "Parameters": {
              "MatchCriteria": {
                "Type": "String",
                "Description": {
                  "en": "The type of the private pool to generate after the capacity reservation takes effect. Valid values:\nOpen: open private pool\nTarget: targeted private pool\nDefault value: Open."
                },
                "AllowedValues": [
                  "Open",
                  "Target"
                ],
                "Required": false
              },
              "Name": {
                "Type": "String",
                "Description": {
                  "en": "The name of the capacity reservation. The name must be 2 to 128 characters in length. The description must start with a letter but cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-)."
                },
                "Required": false
              }
            }
          },
          "Type": "Json",
          "Required": false
        },
        "ZoneId": {
          "AssociationProperty": "ZoneId",
          "Type": "String",
          "Description": {
            "en": "The ID of zone N within the region in which to create the capacity reservation. A capacity reservation can reserve resources within only a single zone."
          },
          "Required": true
        },
        "ResourceGroupId": {
          "AssociationProperty": "ALIYUN::ECS::ResourceGroup::ResourceGroupId",
          "Type": "String",
          "Description": {
            "en": "The ID of the resource group to which to assign the capacity reservation."
          },
          "Required": false
        },
        "EndTimeType": {
          "Type": "String",
          "Description": {
            "en": "The release mode of the capacity reservation. Valid values:\nLimited: The capacity reservation is automatically released at the specified time. If you specify this parameter, you must also specify the EndTime parameter.\nUnlimited: The capacity reservation must be manually released. You can release it anytime."
          },
          "AllowedValues": [
            "Limited",
            "Unlimited"
          ],
          "Required": false
        },
        "InstanceType": {
          "Type": "String",
          "Description": {
            "en": "The instance type. A capacity reservation can be created to reserve the capacity of only a single instance type. You can call the DescribeInstanceTypes operation to query the instance types provided by ECS."
          },
          "Required": true
        },
        "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
        }
      },
      "Resources": {
        "CapacityReservation": {
          "Type": "ALIYUN::ECS::CapacityReservation",
          "Properties": {
            "Description": {
              "Ref": "Description"
            },
            "InstanceAmount": {
              "Ref": "InstanceAmount"
            },
            "EndTime": {
              "Ref": "EndTime"
            },
            "PrivatePoolOptions": {
              "Ref": "PrivatePoolOptions"
            },
            "ZoneId": {
              "Ref": "ZoneId"
            },
            "ResourceGroupId": {
              "Ref": "ResourceGroupId"
            },
            "EndTimeType": {
              "Ref": "EndTimeType"
            },
            "InstanceType": {
              "Ref": "InstanceType"
            },
            "Tags": {
              "Ref": "Tags"
            }
          }
        }
      },
      "Outputs": {
        "PrivatePoolOptionsId": {
          "Description": "The ID of the capacity reservation.",
          "Value": {
            "Fn::GetAtt": [
              "CapacityReservation",
              "PrivatePoolOptionsId"
            ]
          }
        }
      }
    }