ALIYUN::ECS::Activation類型用于創建一個激活碼。
該激活碼用于將非阿里云服務器注冊為阿里云托管實例。
語法
{
"Type": "ALIYUN::ECS::Activation",
"Properties": {
"InstanceName": String,
"InstanceCount": Integer,
"Description": String,
"TimeToLiveInHours": Integer,
"IpAddressRange": String,
"Tags": List
}
}
屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
InstanceName | String | 否 | 否 | 默認的實例名稱前綴。 | 支持2~50個字符,且必須以字母開頭,不能以特殊字符及數字開頭, 只可包含特殊字符中的半角句號(.)、下劃線(_)、短劃線(-)和半角冒號(:),不可以使用 使用該接口創建的激活碼注冊的實例,將使用該名稱作為前輟,生成有序的實例名。您也可以在注冊托管實例時,指定新的實例名稱以覆蓋此默認值。 注冊托管實例時,如果指定了InstanceName的值,則會生成名稱 |
InstanceCount | Integer | 否 | 否 | 激活碼用于注冊托管實例的使用次數上限。 | 取值范圍為1~1000。 默認值為10。 |
Description | String | 否 | 否 | 激活碼對應的描述。 | 支持1~100個字符。 |
TimeToLiveInHours | Integer | 否 | 否 | 激活碼的有效使用時間。 | 過期后將不能用于注冊新的實例。單位:小時。取值范圍為1~876576,即1小時~100年。 默認值為4小時。 |
IpAddressRange | String | 否 | 否 | 允許使用該激活碼的主機IP。 | 取值為對應的IPv4地址、IPv6地址或CIDR地址段。 |
Tags | List | 否 | 是 | 標簽列表。 | 標簽數量范圍為1~20。更多信息,請參見Tags屬性。 |
Tags語法
"Tags": [
{
"Value": String,
"Key": String
}
]
Tags屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
Value | String | 否 | 否 | 托管實例激活碼的標簽值。 | 該值可以為空字符串。 |
Key | String | 是 | 否 | 托管實例激活碼的標簽鍵。 | 一旦傳入該值,則不允許為空字符串 |
返回值
Fn::GetAtt
DeregisteredCount:已注銷的實例數。
ActivationId:激活碼ID。
RegisteredCount:已注冊實例的數量。
ActivationCode:激活碼的代碼。
示例
YAML
格式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
JSON
格式{ "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" ] } } } }