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
  • 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
  • RedHat 5, RedHat 6, RedHat 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

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. Only the China (Hangzhou), China (Beijing), and China (Shanghai) regions are supported.

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 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 cannot be used to register a new instance after the validity period 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
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 queried again. Make sure that you properly save the return value.

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

The ID of the activation code.

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

The ID of the request.

Examples

Sample requests

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

Sample success responses

XML format

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

JSON format

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

Error codes

HttpCode 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 within the specified region. Check whether the RegionId parameter is valid.
404 Operation.Forbidden The operation is not permitted. The error message returned because this operation is not supported.

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