All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::Activation

更新時間:Apr 17, 2025

ALIYUN::ECS::Activation is used to create an activation code.

Note

You can use the activation code to register servers that are not provided by Alibaba Cloud as Alibaba Cloud managed instances.

Syntax

{
  "Type": "ALIYUN::ECS::Activation",
  "Properties": {
    "InstanceName": String,
    "InstanceCount": Integer,
    "Description": String,
    "TimeToLiveInHours": Integer,
    "IpAddressRange": String,
    "ResourceGroupId": String,
    "Tags": List
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

InstanceName

String

No

No

The default instance name prefix.

The prefix must be 2 to 50 characters in length, and can contain only periods (.), underscores (_), hyphens (-), and colons (:). It must start with a letter and cannot start with a special character, a digit, http://, or https://.

If you use the activation code created by using ALIYUN::ECS::Activation to register managed instances, sequential names that are prefixed with the value of this property are assigned to the instances. You can also specify a new instance name to replace the assigned sequential name when you register a managed instance.

If you specify InstanceName when you register a managed instance, an instance name in the <InstanceName>-<Number> format is generated. The number of digits in the <Number> value varies based on the number of digits in the InstanceCount value. Example of Number: 001. If you do not specify InstanceName, the hostname (Hostname) is used as the instance name.

InstanceCount

Integer

No

No

The maximum number of times that you can use the activation code to register managed instances.

Valid values: 1 to 1000.

Default value: 10.

Description

String

No

No

The description of the activation code.

The description must be 1 to 100 characters in length.

TimeToLiveInHours

Integer

No

No

The validity period of the activation code.

You cannot use the activation code to register a new instance after the validity period expires. Unit: hour. Valid values: 1 to 876576. The valid values represent a time range from 1 hour to 100 years.

Default value: 4.

IpAddressRange

String

No

No

The IP addresses of hosts that are allowed to use the activation code.

The value can be IPv4 addresses, IPv6 addresses, or CIDR blocks.

ResourceGroupId

String

No

Yes

The ID of the resource group.

None.

Tags

List

No

Yes

The tags.

You can add 1 to 20 tags. For more information, see Tags properties.

Tags syntax

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

Tags properties

Property

Type

Required

Editable

Description

Constraint

Value

String

No

No

The value of the tag that you want to add to the activation code.

The value can be an empty string.

Key

String

Yes

No

The key of the tag that you want to add to the activation code.

The key cannot be an empty string.

Return values

Fn::GetAtt

  • DeregisteredCount: the number of deregistered instances.  

  • ActivationId: the ID of the activation code.

  • RegisteredCount: the number of registered instances.

  • ActivationCode: the value of the activation code.

  • Arn: the Alibaba Cloud Resource Name (ARN).

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  Description:
    Description:
      en: The description of the activation code. It must be 1 to 100 characters in
        length.
    MaxLength: 100
    MinLength: 1
    Type: String
  InstanceCount:
    Description:
      en: 'The maximum number of times that you can use the activation code to register
        managed instances. Valid values: 1 to 1000.Default value: 10.'
    MaxValue: 1000
    MinValue: 1
    Type: Number
  InstanceName:
    Description:
      en: 'The default instance name prefix. The instance name prefix must be 2 to
        50 characters in length. It must start with a letter and cannot start with
        http:// or https://. It can contain letters, digits, periods (.), underscores
        (_), hyphens (-), and colons (:). If you use the activation code that is created
        by calling this operation (CreateActivation) to register managed instances,
        the instances are assigned sequential names that are prefixed by the value
        of this parameter. You can also specify a new instance name to replace the
        assigned sequential name when you register a managed instance.If you specify
        InstanceName when you register a managed instance, an instance name in theformat
        of - is generated. The number of digits in the 
        value isdetermined by that in the InstanceCount value. Example: 001. If you
        do not specify InstanceName, the hostname (Hostname) is used as the instance
        name.'
    Type: String
  IpAddressRange:
    Description:
      en: The IP addresses of hosts that are allowed to use the activation code. The
        value can be IPv4 addresses, IPv6 addresses, or CIDR blocks.
    Type: String
  RegionId:
    Description:
      en: Region ID of instance. Default is current region.
    Type: String
  Tags:
    AssociationProperty: List[Parameter]
    AssociationPropertyMetadata:
      Parameter:
        AssociationPropertyMetadata:
          Parameters:
            Key:
              Type: String
            Value:
              Type: String
        Type: Json
    Description:
      en: Tags to attach to instance. Max support 20 tags to add during create instance.
        Each tag with two properties Key and Value, and Key is required.
    MaxLength: 20
    Type: Json
  TimeToLiveInHours:
    Description:
      en: 'The validity period of the activation code. The activation code can no
        longer be used to register instances after the period ends. Unit: hours. Valid
        values: 1 to 876576, which represents a range of time from 1 hour to 100 years.Default
        value: 4.'
    MaxValue: 876576
    MinValue: 1
    Type: Number
Resources:
  Activation:
    Properties:
      Description:
        Ref: Description
      InstanceCount:
        Ref: InstanceCount
      InstanceName:
        Ref: InstanceName
      IpAddressRange:
        Ref: IpAddressRange
      RegionId:
        Ref: RegionId
      Tags:
        Ref: Tags
      TimeToLiveInHours:
        Ref: TimeToLiveInHours
    Type: ALIYUN::ECS::Activation
Outputs:
  ActivationCode:
    Description: Activation code.
    Value:
      Fn::GetAtt:
      - Activation
      - ActivationCode
  ActivationId:
    Description: Activation code ID.
    Value:
      Fn::GetAtt:
      - Activation
      - ActivationId
  DeregisteredCount:
    Description: The number of instances that have been logged out.
    Value:
      Fn::GetAtt:
      - Activation
      - DeregisteredCount
  RegisteredCount:
    Description: The number of registered instances.
    Value:
      Fn::GetAtt:
      - Activation
      - RegisteredCount
                        
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "InstanceName": {
      "Type": "String",
      "Description": {
        "en": "The default instance name prefix. The instance name prefix must be 2 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, periods (.), underscores (_), hyphens (-), and colons (:). If you use the activation code that is created by calling this operation (CreateActivation) to register managed instances, the instances are assigned sequential names that are prefixed by the value of this parameter. You can also specify a new instance name to replace the assigned sequential name when you register a managed instance.If you specify InstanceName when you register a managed instance, an instance name in theformat of - is generated. The number of digits in the  value isdetermined by that in the InstanceCount value. Example: 001. If you do not specify InstanceName, the hostname (Hostname) is used as the instance name."
      }
    },
    "InstanceCount": {
      "Type": "Number",
      "Description": {
        "en": "The maximum number of times that you can use the activation code to register managed instances. Valid values: 1 to 1000.Default value: 10."
      },
      "MinValue": 1,
      "MaxValue": 1000
    },
    "Description": {
      "Type": "String",
      "Description": {
        "en": "The description of the activation code. It must be 1 to 100 characters in length."
      },
      "MinLength": 1,
      "MaxLength": 100
    },
    "TimeToLiveInHours": {
      "Type": "Number",
      "Description": {
        "en": "The validity period of the activation code. The activation code can no longer be used to register instances after the period ends. Unit: hours. Valid values: 1 to 876576, which represents a range of time from 1 hour to 100 years.Default value: 4."
      },
      "MinValue": 1,
      "MaxValue": 876576
    },
    "RegionId": {
      "Type": "String",
      "Description": {
        "en": "Region ID of instance. Default is current region."
      }
    },
    "IpAddressRange": {
      "Type": "String",
      "Description": {
        "en": "The IP addresses of hosts that are allowed to use the activation code. The value can be IPv4 addresses, IPv6 addresses, or CIDR blocks."
      }
    },
    "Tags": {
      "AssociationPropertyMetadata": {
        "Parameter": {
          "AssociationPropertyMetadata": {
            "Parameters": {
              "Value": {
                "Type": "String"
              },
              "Key": {
                "Type": "String"
              }
            }
          },
          "Type": "Json"
        }
      },
      "AssociationProperty": "List[Parameter]",
      "Type": "Json",
      "Description": {
        "en": "Tags to attach to instance. Max support 20 tags to add during create instance. Each tag with two properties Key and Value, and Key is required."
      },
      "MaxLength": 20
    }
  },
  "Resources": {
    "Activation": {
      "Type": "ALIYUN::ECS::Activation",
      "Properties": {
        "InstanceName": {
          "Ref": "InstanceName"
        },
        "InstanceCount": {
          "Ref": "InstanceCount"
        },
        "Description": {
          "Ref": "Description"
        },
        "TimeToLiveInHours": {
          "Ref": "TimeToLiveInHours"
        },
        "RegionId": {
          "Ref": "RegionId"
        },
        "IpAddressRange": {
          "Ref": "IpAddressRange"
        },
        "Tags": {
          "Ref": "Tags"
        }
      }
    }
  },
  "Outputs": {
    "DeregisteredCount": {
      "Description": "The number of instances that have been logged out.",
      "Value": {
        "Fn::GetAtt": [
          "Activation",
          "DeregisteredCount"
        ]
      }
    },
    "ActivationId": {
      "Description": "Activation code ID.",
      "Value": {
        "Fn::GetAtt": [
          "Activation",
          "ActivationId"
        ]
      }
    },
    "RegisteredCount": {
      "Description": "The number of registered instances.",
      "Value": {
        "Fn::GetAtt": [
          "Activation",
          "RegisteredCount"
        ]
      }
    },
    "ActivationCode": {
      "Description": "Activation code.",
      "Value": {
        "Fn::GetAtt": [
          "Activation",
          "ActivationCode"
        ]
      }
    }
  }
}