Creates an activation code. This activation code is used to register servers that are not provided by Alibaba Cloud as Alibaba Cloud managed instances.

Description

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 a variety of online services provided by Alibaba Cloud, such as Cloud Assistant, Operation Orchestration Service (OOS), and Apsara Devops in the managed instance.

If a server is not provided by Alibaba Cloud, it can be registered as an Alibaba Cloud managed instance only when the server can access the Internet 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 create up to 100 activation codes within a single Alibaba Cloud region. For information about how to query quotas, see the "Step 1: View resource quotas" section in View and increase resource quotas.

Note Alternatively, you can call the DescribeAccountAttributes operation and set AttributeName.N to max-cloud-assistant-activation-count to query the maximum number of activation codes that can be created within a specified region.

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 ID of the region in which to create the activation code. The following regions are supported: China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Heyuan), and China (Hong Kong).

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 1 to 50 characters in length. It must start with a letter and cannot start with http:// or https://. The instance name prefix can contain only letters, digits, periods (.), underscores (_), hyphens (-), and colons (:).

If you use the activation code created by calling the CreateActivation operation 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 override 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 format of <InstanceName>-<Number> is generated. The number of digits in the <Number> value is determined by that 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 can be 1 to 100 characters in length and cannot start with http:// or https://.

InstanceCount Integer No 10

The maximum number of times that the activation code can be used 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 code expires. Unit: hours. Valid values: 1 to 24.

Default value: 4.

IpAddressRange String No 0.0.0.0/0

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

Response parameters

Parameter Type Example Description
RequestId String 4ECEEE12-56F1-4FBC-9AB1-890F1234****

The ID of the request.

ActivationCode String a-hz0ch3SwhOlE1234+Xo32lAZC****

The value of the activation code. The value is returned only once after the CreateActivation operation is called and cannot be subsequently queried. Make sure that you 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 response

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 error message returned because the API operation cannot be called in the specified region. Check whether the RegionId parameter is valid.
400 InstanceName.ExceedLimit Default instance name prefix length exceeds. The error message returned because the instance name prefix exceeds 50 characters in length.
400 InstanceName.InvalidPattern Default instance name prefix pattern invalid. The error message returned because the instance name prefix is invalid.
400 ActivationDesc.ExceedLimit Activation description length exceeds. The error message returned because the description of the activation code exceeds 100 characters in length.
400 ActivationLimitation.Invalid Registration limitation must be positive. The error message returned because the maximum number of times that the activation code can be used to register managed instances has been reached.
400 AddressRange.InvalidPattern Address range should be ipv4 address or cidr. The error message returned because 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 error message returned because the maximum number of activation codes that can be created has been reached.
400 ActivationTTL.ExceedLimit Activation TTL exceeds limit. The error message returned because the specified value of the TimeToLiveInHours parameter is invalid.
403 Operation.Forbidden The operation is not permitted. The error message returned because the operation is not supported.
500 InternalError.Dispatch An error occurred when dispatch the request. The error message returned because an error occurred while the request was being sent. Try again later.

For a list of error codes, visit the API Error Center.