CreateActivation

Updated at:

Creates an activation code (dynamic code) that is used to register a server other than Elastic Compute Service as an Alibaba Cloud managed instance.

Operation description

Operation description

After you register a server other than Elastic Compute Service as an Alibaba Cloud managed instance by using an activation code (dynamic code), you can use various online services provided by Alibaba Cloud, such as Cloud Assistant, operations management, and Apsara DevOps, on the managed instance.

The operating system of the non-Alibaba Cloud server must meet the following version requirements, and the server must have access to the Internet before it can be registered as an Alibaba Cloud managed instance.

  • Alibaba Cloud Linux 2, 3, or later

  • CentOS 6, 7, 8, or later

  • Debian 8, 9, 10, or later

  • Ubuntu 12, 14, 16, 18, or later

  • CoreOS

  • OpenSUSE

  • Red Hat 5, 6, 7, or later

  • SUSE Linux Enterprise Server 11, 12, 15, or later

  • Windows Server 2012, 2016, 2019, or later

In an Alibaba Cloud region, you can have up to 10 activation codes for managed instances. A single activation code can be used to activate up to 10 instances, and the maximum validity period of a single activation code is 4 hours.

Note

You can go to the Managed Instances tab on the Cloud Assistant page and click Register New Instance to obtain the activation code (dynamic code) and its usage data.

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. Supported regions: 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 invoke the DescribeRegions operation to query the most recent region list.

cn-hangzhou

InstanceName

string

No

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

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

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

test-InstanceName

Description

string

No

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

This is description.

InstanceCount

integer

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.

10

TimeToLiveInHours

integer

No

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

Default value: 4.

4

IpAddressRange

string

No

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

0.0.0.0/0

ClientToken

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 you must make sure that the token is unique among different requests. The ClientToken parameter can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

123e4567-e89b-12d3-a456-426655440000

ResourceGroupId

string

No

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

rg-123******

Tag

array<object>

No

The list of tags.

object

No

The list of tags.

Key

string

No

The key of tag N of the managed instance activation code (dynamic code). Valid values of N: 1 to 20. If you specify this parameter, it cannot be an empty string.

If you use a single tag to filter resources, the resource count returned cannot exceed 1,000. If you use multiple tags to filter resources, the resource count of resources that are attached to all the specified tags cannot exceed 1,000. If the resource count exceeds 1,000, you must invoke the ListTagResources operation to query the resources.

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

TestKey

Value

string

No

The value of tag N of 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 activation code. The code is returned only once when the operation is called and cannot be queried later. Make sure that you securely store the return value.

a-hz0ch3SwhOlE1234+Xo32lAZC****

ActivationId

string

The ID of the activation code.

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. The number of times that the activation code can be used to register managed instances exceeds the limit.
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. The number of activation codes that can be created exceeds the upper limit.
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. The specified idempotency parameter is invalid.
500 InternalError.Dispatch An error occurred when dispatch the request. An error occurred while the request is being sent. Try again later.
403 InvalidParameterCharacter The specified parameter %s contains illegal characters.
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. The request parameters do not match those of a previous request with the same 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.