All Products
Search
Document Center

Elastic Compute Service:CreateActivation

Last Updated:Mar 13, 2024

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

Operation 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 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.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The ID of the region in which to create 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 all the DescribeRegions operation to query the most recent region list.

cn-hangzhou
InstanceNamestringNo

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 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.

test-InstanceName
DescriptionstringNo

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

This is description.
InstanceCountintegerNo

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

Default value: 10.

10
TimeToLiveInHourslongNo

The validity period of the activation code. The activation code can no longer be used to register instances after the period expires. Unit: hours. Valid values: 1 to 876576, which represents a range of time from 1 hour to 100 years.

Default value: 4.

4
IpAddressRangestringNo

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

0.0.0.0/0
ResourceGroupIdstringNo

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

rg-123******
Tagobject []No

The tags to add to the activation code.

KeystringNo

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

If a single tag is specified to query resources, up to 1,000 resources that have this tag added can be displayed in the response. If multiple tags are specified to query resources, up to 1,000 resources that have all these tags added can be displayed in the response. To query more than 1,000 resources that have specified tags, call ListTagResources .

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

TestKey
ValuestringNo

The value of tag N to add to the activation code. Valid values of N: 1 to 20. The tag value can be an empty string.

It can be up to 128 characters in length and cannot contain http:// or https://.

TestValue

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

4ECEEE12-56F1-4FBC-9AB1-890F1234****
ActivationCodestring

The value of the activation code. The value is returned only once after the CreateActivation operation is called and cannot be queried afterward. Properly save the return value.

a-hz0ch3SwhOlE1234+Xo32lAZC****
ActivationIdstring

The ID of the activation code.

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

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400RegionId.ApiNotSupportedThe api is not supported in this region.The API operation cannot be called in the specified region. Check whether the specified RegionId parameter is valid.
400InstanceName.ExceedLimitDefault instance name prefix length exceeds.The length of the instance name prefix exceeds the upper limit.
400InstanceName.InvalidPatternDefault instance name prefix pattern invalid.The instance name prefix is invalid.
400ActivationDesc.ExceedLimitActivation description length exceeds.The length of the activation code description exceeds the upper limit.
400ActivationLimitation.InvalidRegistration limitation must be positive.The maximum number of times that the activation code can be used to register managed instances has been reached.
400AddressRange.InvalidPatternAddress range should be ipv4 address or cidr.The IP addresses of hosts that can use the activation code must be IPv4 addresses, IPv6 addresses, or CIDR blocks.
400ActivationCount.ExceedLimitToo many activations have been created.The maximum number of activation codes that can be created is exceeded.
400ActivationTTL.ExceedLimitActivation TTL exceeds limit.The validity period of the activation code is out of range.
400InvalidTagKey.MalformedThe specified Tag.n.Key is not valid.The specified Tag.N.Key parameter is invalid.
400InvalidTagValue.MalformedThe specified Tag.n.Value is not valid.The specified tag value is invalid.
400NumberExceed.TagsThe Tags parameter number is exceed.The number of tags exceeds the maximum limit.
400MissingParameter.TagKeyYou must specify Tag.N.Key.The tag key is not specified.
400Duplicate.TagKeyThe Tag.N.Key contain duplicate key.The specified tag key already exists. Tag keys must be unique.
403Operation.ForbiddenThe operation is not permitted.The operation is not supported.
403InvalidStatus.ResourceGroupYou cannot perform an operation on a resource group that is being created or deleted.Operation not allowed while resource group is being created or deleted.
404InvalidRegionId.NotFoundThe RegionId provided does not exist in our records.The RegionId provided does not exist
404InvalidResourceGroup.NotFoundThe ResourceGroup provided does not exist in our records.The specified resource group does not exist.
500InternalError.DispatchAn error occurred when dispatch the request.An error occurred while the request is being sent. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-10-24The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 403 change
    Error Codes 404 change
    delete Error Codes: 400
    delete Error Codes: 500
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: ResourceGroupId
2021-10-15The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 404 change
    delete Error Codes: 400
    delete Error Codes: 500
    Added Error Codes: 403
2021-10-15The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 404
    delete Error Codes: 500