All Products
Search
Document Center

Elastic Compute Service:CreateActivation

Last Updated:Jun 25, 2026

Creates an activation code that is used to register non-Alibaba Cloud servers as Alibaba Cloud managed instances.

Operation description

Operation description

After you use an activation code to register a non-Alibaba Cloud server as an Alibaba Cloud managed instance, you can use various online services provided by Alibaba Cloud in the managed instance, such as Cloud Assistant, CloudOps Orchestration Service, and Alibaba Cloud DevOps.

The operating system of the non-Elastic Compute Service (ECS) server must meet the following version requirements, and the server must have Internet access to be registered as an Alibaba Cloud managed instance.

  • Alibaba Cloud Linux 2/3 and later

  • CentOS 6/7/8 and later

  • Debian 8/9/10 and later

  • Ubuntu 12/14/16/18 and later

  • CoreOS

  • OpenSUSE

  • RedHat 5/6/7 and later

  • SUSE Linux Enterprise Server 11/12/15 and later

  • Window Server 2012/2016/2019 and later

In each Alibaba Cloud region, you can have up to 10 managed instance activation codes. Each activation code can be used to register up to 10 instances, and each activation code is valid for up to 4 hours.

Note

On the ECS Cloud Assistant page, click the Managed Instances tab, and then click Register New Instance to view the usage data of activation codes.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:CreateActivation

create

*Activation

acs:ecs:{#regionId}:{#accountId}:activation/*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID. Currently supported regions include China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Ulanqab), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Heyuan), China (Guangzhou), China (Chengdu), Hong Kong (China), Singapore, Japan (Tokyo), US (Silicon Valley), and US (Virginia). You can call DescribeRegions to query region IDs and other information.

cn-hangzhou

RegionId

string

Yes

The default instance name prefix. The value must be 2 to 50 characters in length and must start with a letter. It cannot start with a special character or digit. It can contain only periods (.), underscores (_), hyphens (-), and colons (:). It cannot start with http:// or https://.

Instances registered with the activation code created by this operation use this value as the prefix to generate sequential instance names. You can also specify a new instance name when you register a managed instance to override this default value.

When you register a managed instance, if you specify a value for InstanceName, a name in the format of <InstanceName>-001 is generated. The number of digits in 001 depends on the number of digits in the InstanceCount value. If you do not specify a value for InstanceName, the hostname of the host is used as the instance name.

cn-hangzhou

InstanceName

string

No

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

test-InstanceName

Description

string

No

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

Default value: 10.

This is description.

InstanceCount

integer

No

The validity period of the activation code. After the validity period expires, the activation code cannot be used to register new instances. Unit: hours. Valid values: 1 to 4.

Default value: 4.

10

TimeToLiveInHours

integer

No

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

4

IpAddressRange

string

No

The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but make sure that the token is unique among different requests. ClientToken supports only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

0.0.0.0/0

ClientToken

string

No

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

123e4567-e89b-12d3-a456-426655440000

ResourceGroupId

string

No

The tags.

rg-123******

Tag

array<object>

No

The tags.

object

No

The tags.

Key

string

No

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

If you use a single tag to filter resources, the number of resources that are returned under that tag cannot exceed 1,000. If you use multiple tags to filter resources, the number of resources that are bound with all specified tags cannot exceed 1,000. If the number of resources exceeds 1,000, you must call the ListTagResources operation to query the resources.

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

TestKey

Value

string

No

The value of the tag for the managed instance 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://.

TestValue

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

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

ActivationCode

string

The value of the activation code. The code is returned only once when you call this operation and cannot be queried afterward. Store the return value properly.

a-hz0ch3SwhOlE1234+Xo32lAZC****

ActivationId

string

The activation code ID.

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

Examples

Success response

JSON format

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

Error codes

HTTP status code

Error code

Error message

Description

400 RegionId.ApiNotSupported The 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.
400 InstanceName.ExceedLimit Default instance name prefix length exceeds. The length of the instance name prefix exceeds the upper limit.
400 InstanceName.InvalidPattern Default instance name prefix pattern invalid. The instance name prefix is invalid.
400 ActivationDesc.ExceedLimit Activation description length exceeds. The length of the activation code description exceeds the upper limit.
400 ActivationLimitation.Invalid The specified parameter InstanceCount exceeds the limit of %s.
400 AddressRange.InvalidPattern Address 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.
400 ActivationCount.ExceedLimit The count of activation in current region exceeds the limit of %s.
400 ActivationTTL.ExceedLimit The specified parameter TimeToLiveInHours exceeds the limit of %s. The specified parameter TimeToLiveInHours exceeds the limit of% s.
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid. The specified Tag.N.Key parameter is invalid.
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid. The specified tag value is invalid.
400 NumberExceed.Tags The Tags parameter number is exceed. The number of tags exceeds the maximum limit.
400 MissingParameter.TagKey You must specify Tag.N.Key. The tag key is not specified.
400 Duplicate.TagKey The Tag.N.Key contain duplicate key. The specified tag key already exists. Tag keys must be unique.
400 InvalidClientToken.Malformed The specified parameter clientToken is not valid.
500 InternalError.Dispatch An error occurred when dispatch the request. An error occurred while the request is being sent. Try again later.
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. Operation not allowed while resource group is being created or deleted.
403 RealNameAuthenticationError Your account has not passed the real-name authentication yet. You have not completed real-name verification. Complete real-name verification and try again.
403 ManagedInstanceCountExceedLimit The count of managed instance in current region exceeds the limit of %s. The number of managed instances in the current region exceeds the limit of% s.
403 IdempotentParameterMismatch The specified parameter has changed while using an already used clientToken.
403 IdempotentProcessing The previous idempotent request(s) is still processing. A previous idempotent request is being processed. Try again later.
404 InvalidRegionId.NotFound The RegionId provided does not exist in our records. Region information error
404 InvalidResourceGroup.NotFound The ResourceGroup provided does not exist in our records. The specified resource group does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.