All Products
Search
Document Center

:CreateActivation

更新時間:Jan 19, 2024

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

Usage notes

After you use an activation code to register a server that is not provided by Alibaba Cloud as an Alibaba Cloud managed instance, you can use various online services of Alibaba Cloud, such as Cloud Assistant, CloudOps Orchestration Service (OOS), and Apsara Devops, on the managed instance.

If a server is not provided by Alibaba Cloud, you can register the server as an Alibaba Cloud managed instance only if the server has Internet connectivity and runs an operating system of one of the following versions:

  • Alibaba Cloud Linux 2, Alibaba Cloud Linux 3, and later
  • CentOS 6, CentOS 7, CentOS 8, and later
  • Debian 8, Debian 9, Debian 10, and later
  • Ubuntu 12, Ubuntu 14, Ubuntu 16, Ubuntu 18, and later
  • CoreOS
  • OpenSUSE
  • Red Hat 5, Red Hat 6, Red Hat 7, and later
  • SUSE Linux Enterprise Server (SLES) 11, SLES 12, SLES 15, and later
  • Windows Server 2012, Windows Server 2016, Windows Server 2019, and later

You can have up to 5,000 activation codes per Alibaba Cloud region. When the number of activation codes exceeds 1,000, the usage of the activation codes must be greater than 50% before you can proceed to create more activation codes.

Note To query the usage of activation codes, go to the Cloud Assistant page in the Elastic Compute Service (ECS) console, click the Manage Instances tab, and then click Register Instance.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action String Yes CreateActivation

The operation that you want to perform. Set the value to CreateActivation.

RegionId String Yes cn-hangzhou

The region ID of the activation code. Supported regions: China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Ulanqab), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Heyuan), China (Guangzhou), China (Chengdu), China (Hong Kong), Singapore, Japan (Tokyo), US (Silicon Valley), and US (Virginia).

You can call the DescribeRegions operation to query the most recent region list.

InstanceName String No test-InstanceName

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 the CreateActivation operation to register managed instances, the instances are assigned sequential names that include the value of this parameter as a prefix. 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: 001. If you do not specify InstanceName, the hostname (Hostname) is used as the instance name.

Description String No This is description.

The description of the activation code. The description must be 1 to 100 characters in length.

InstanceCount Integer No 10

The maximum number of times that you can use the activation code to register managed instances. Valid values: 1 to 1000.

Default value: 10.

TimeToLiveInHours Long No 4

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. This represents a time range from 1 hour to 100 years.

Default value: 4.

IpAddressRange String No 0.0.0.0/0

The IP addresses of hosts that can use the activation code. The value can be IPv4 addresses, IPv6 addresses, or CIDR blocks.

ResourceGroupId String No rg-123******

The ID of the resource group to which the activation code belongs.

Tag.N.Key String No TestKey

The key of tag N that you want to add to the activation code. Valid values of N: 1 to 20. The tag key cannot be an empty string.

If you specify a single tag to query resources, up to 1,000 resources to which this tag is added can be returned. If you specify multiple tags to query resources, up to 1,000 resources to which all these tags are added can be returned. To query more than 1,000 resources that have the specified tags, call the ListTagResources operation.

The tag key can be up to 64 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.

Tag.N.Value String No TestValue

The value of tag N that you want to add to the activation code. 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 contain http:// or https://.

Response parameters

Parameter

Type

Example

Description

RequestId String 4ECEEE12-56F1-4FBC-9AB1-890F1234****

The request ID.

ActivationCode String a-hz0ch3SwhOlE1234+Xo32lAZC****

The value of the activation code. The value is returned only once after the CreateActivation operation is called. Properly save the return value.

ActivationId String 4ECEEE12-56F1-4FBC-9AB1-890F1234****

The ID of the activation code.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=CreateActivation
&InstanceName=test-InstanceName
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateActivationResponse>
    <RequestId>4ECEEE12-56F1-4FBC-9AB1-890F1234****</RequestId>
    <ActivationId>4ECEEE12-56F1-4FBC-9AB1-890F1234****</ActivationId>
    <ActivationCode>a-hz0ch3SwhOlE1234+Xo32lAZC****</ActivationCode>
</CreateActivationResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "4ECEEE12-56F1-4FBC-9AB1-890F1234****",
  "ActivationId" : "4ECEEE12-56F1-4FBC-9AB1-890F1234****",
  "ActivationCode" : "a-hz0ch3SwhOlE1234+Xo32lAZC****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 RegionId.ApiNotSupported The api is not supported in this region. The operation cannot be called in the specified region. Check whether the region ID is valid.
400 InstanceName.ExceedLimit Default instance name prefix length exceeds. The maximum length of the instance name prefix is exceeded.
400 InstanceName.InvalidPattern Default instance name prefix pattern invalid. Invalid InstanceName value.
400 ActivationDesc.ExceedLimit Activation description length exceeds. The maximum length of the activation code description is exceeded.
400 ActivationLimitation.Invalid Registration limitation must be positive. The maximum number of times that the activation code can be used to register managed instances is exceeded.
400 AddressRange.InvalidPattern Address range should be ipv4 address or cidr. The IP addresses of hosts that are allowed to use the activation code must be IPv4 addresses, IPv6 addresses, or CIDR blocks.
400 ActivationCount.ExceedLimit Too many activations have been created. The maximum number of activation codes that can be created is exceeded.
400 ActivationTTL.ExceedLimit Activation TTL exceeds limit. Invalid TimeToLiveInHours value.
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid. Invalid Tag.N.Key value.
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid. Invalid Tag.N.Value value.
400 NumberExceed.Tags The Tags parameter number is exceed. The maximum number of tags is exceeded.
400 MissingParameter.TagKey You must specify Tag.N.Key. Tag.N.Key is required.
400 Duplicate.TagKey The Tag.N.Key contain duplicate key. The tag key already exists. Tag keys must be unique.
403 Operation.Forbidden The operation is not permitted. The operation is not supported.
403 InvalidStatus.ResourceGroup You cannot perform an operation on a resource group that is being created or deleted. You cannot perform this operation on a resource group that is being created or deleted.
404 InvalidResourceGroup.NotFound The ResourceGroup provided does not exist in our records. The resource group is not found.
500 InternalError.Dispatch An error occurred when dispatch the request. An error occurred while the request was being sent. Try again later.

For a list of error codes, see Service error codes.