All Products
Search
Document Center

Elastic Compute Service:CreateActivation

Last Updated:Sep 29, 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

Usage notes

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, 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 one of the following operating systems:

  • Alibaba Cloud Linux 2 and Alibaba Cloud Linux 3 and later
  • CentOS 6, CentOS 7, and CentOS 8 and later
  • Debian 8, Debian 9, and Debian 10 and later
  • Ubuntu 12, Ubuntu 14, Ubuntu 16, and Ubuntu 18 and later
  • CoreOS
  • OpenSUSE
  • Red Hat 5, Red Hat 6, and Red Hat 7 and later
  • SUSE Linux Enterprise Server 11, SUSE Linux Enterprise Server 12, and SUSE Linux Enterprise Server 15 and later
  • Windows Server 2012, Windows Server 2016, and 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 create additional activation codes.

Note To obtain the usage of activation codes, go to the ECS Cloud Assistant page, 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

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:CreateActivationcreate
  • Activation
    acs:ecs:{#regionId}:{#accountId}:activation/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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), China (Hong Kong), Singapore, Japan (Tokyo), US (Silicon Valley), and US (Virginia). You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
InstanceNamestringNo

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

If you use the activation code that is created by calling the CreateActivation operation to register managed instances, the instances are assigned sequential names that include the value of this parameter as a prefix. 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 <InstanceName>-<Number> format is generated. The number of digits in the <Number> value varies based on the number of digits 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. The description 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. After the validity period ends, you can no longer use the activation code to register managed instances. Unit: hours. Valid values: 1 to 876576. 876576 hours is equal 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******
Tagarray<object>No

The tags to add to the activation code.

objectNo

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.
403RealNameAuthenticationErrorYour account has not passed the real-name authentication yet.You have not completed real-name verification. Complete real-name verification and try again.
403ManagedInstanceCountExceedLimitThe 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.
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
2024-09-18The Error code has changedView Change Details
2024-07-31The Error code has changedView Change Details
2023-10-24The Error code has changed. The request parameters of the API has changedView Change Details
2021-10-15The Error code has changedView Change Details
2021-10-15The Error code has changedView Change Details