Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::ECS::CapacityReservation

Última atualização: Jun 27, 2026

Crie uma reserva de capacidade para um tipo específico de instância ECS em uma zona.

Sintaxe

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

Propriedades

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrição

InstanceAmount

Integer

Sim

Sim

Número total de instâncias com capacidade reservada.

Valores válidos: 1 a 1000.

Description

String

Não

Sim

Descrição da reserva de capacidade.

A descrição deve ter entre 2 e 256 caracteres e não pode começar com http:// ou https://.

PrivatePoolOptions

Map

Não

Sim

Configurações do pool privado.

Para mais informações, consulte Propriedades de PrivatePoolOptions.

ZoneId

String

Sim

Não

ID da zona da reserva de capacidade.

Uma reserva de capacidade abrange recursos apenas em uma única zona.

ResourceGroupId

String

Não

Não

ID do grupo de recursos ao qual atribuir a reserva de capacidade.

Nenhuma.

EndTime

String

Não

Sim

Hora de expiração da reserva de capacidade.

Especifique a hora no padrão ISO 8601 no formato yyyy-MM-ddTHH:mm:ssZ. A hora deve estar em UTC+0. Para mais informações, consulte Formato de Hora ISO 8601.

EndTimeType

String

Não

Sim

Modo de liberação da reserva de capacidade.

Valores válidos:

  • Limited: o sistema libera a reserva de capacidade automaticamente no momento especificado. Se você defina esta propriedade como Limited, também deverá especificar EndTime.

  • Unlimited: libere a reserva de capacidade manualmente a qualquer momento.

InstanceType

String

Sim

Não

Tipo da instância.

Uma reserva de capacidade abrange apenas um único tipo de instância. Chame a operação DescribeInstanceTypes para consultar os tipos de instância fornecidos pelo Elastic Compute Service (ECS).

Tags

List

Não

Não

Tags a adicionar à reserva de capacidade.

Adicione até 20 tags. Para mais informações, consulte Propriedades de Tags.

Sintaxe de PrivatePoolOptions

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

Propriedades de PrivatePoolOptions

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrição

MatchCriteria

String

Não

Não

Tipo do pool privado gerado após a entrada em vigor da reserva de capacidade.

Valores válidos:

  • Open (padrão): pool privado aberto

  • Target: pool privado especificado

Name

String

Não

Sim

Nome da reserva de capacidade.

O nome deve ter entre 2 e 128 caracteres e começar com uma letra. Não pode iniciar com http:// ou https://. O nome pode conter letras, dígitos, dois-pontos (:), sublinhados (_) e hifens (-).

Sintaxe de Tags

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

Propriedades de Tags

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrição

Value

String

Não

Não

Valor da tag da reserva de capacidade.

O valor da tag pode ser uma string vazia e ter até 128 caracteres. Não pode começar com acs: nem conter http:// ou https://.

Key

String

Não

Não

Chave da tag da reserva de capacidade.

A chave da tag não pode ser uma string vazia e pode ter até 128 caracteres. Não pode começar com aliyun ou acs:, nem conter http:// ou https://.

Valores de retorno

Fn::GetAtt

PrivatePoolOptionsId: o ID da reserva de capacidade.

Exemplos

  • YAML format

    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 format

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