If you register a server that is not provided byAlibaba Cloud as an Alibaba Cloud managed instance, you can manage or use the server by using various online services provided by Alibaba Cloud, such as Cloud Assistant, CloudOps Orchestration Service, and Apsara Devops. For example, you can use Cloud Assistant to manage the server without logging on to the server.
Limits
Limits on a third-party server
The server must run an operating system of one of the following versions:
Alibaba Cloud Linux 2/3
CentOS 6 and later
CoreOS and OpenSUSE
Debian 8, Debian 9, and Debian 10 and later
Red Hat 5, Red Hat 6, and Red Hat 7 and later
SUSE Linux Enterprise Server (SLES) 11, SLES 12, and SLES 15 and later
Ubuntu 12, Ubuntu 14, Ubuntu 16, and Ubuntu 18 and later
Windows Server 2012, Windows Server 2016, and Windows Server 2019 and later
The server can access the Internet.
Region limits on the managed instance feature
The managed instance feature is supported only in the following 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), Japan (Tokyo), and South Korea (Seoul), Singapore, Malaysia (Kuala Lumpur), Indonesia (Jakarta), Philippines (Manila), Thailand (Bangkok), Germany (Frankfurt), UK (London), US (Silicon Valley), US (Virginia), UAE (Dubai), and SAU (Riyadh - Partner Region)
Billing
The managed instance feature is provided by Alibaba Cloud free of charge.
After you register a third-party server as an Alibaba Cloud managed instance, you are charged when you use other Alibaba Cloud services. Specific billing rules vary based on the service you use.
Step 1: Create a registration code
To register a third-party server as an Alibaba Cloud managed instance, create a registration code which is known as an activation code and then apply the code to the server. A registration code is a credential used to verify server identities. The code is used to only allow the verified servers to be registered as Alibaba Cloud managed instances.
A single registration code can be used to register up to 1,000 managed instances.
You can create up to 5,000 registration codes for instances in a region.
When you create more than 1,000 registration codes, more registration codes can be created only if the registration code usage is greater than 50%.
On the ECS Cloud Assistant page, click the Manage Instances tab and then click Register Instance. In the Registered Instances/Registration Quota column, view the usage of registration codes.
Log on to the ECS console.
In the left-side navigation pane, choose .
In the upper-left corner of the top navigation bar, select the region in which you want to register the server as a managed instance.
ImportantThe created registration code and the registered managed instances belong to the region.
We recommend that you select the region where the server is connected to a network at the fastest speed. You can run the Ping command to test the connection speed and then select the region your server is connected at the fastest speed. For information about region IDs, see Regions and zones.
ping -c 4 <Region ID>.axt.aliyuncs.com
On the ECS Cloud Assistant page, click the Manage Instances tab and perform one of the following operations.
Scenario 1: If no instance is registered in the selected region, click Create Registration Code.
Scenario 2: If an instance is registered in the selected region, click Register Instance. In the Register Instance panel, click Create Registration Code.
In the Create Registration Code panel, configure the parameters described in the following table.
Parameter
Description
Instance Name Prefix
The prefix of the names of instances that you want to use for subsequent management.
Source IP Address
The IP addresses or CIDR blocks of managed instances.
If you enter the public IP addresses or CIDR blocks, only the servers whose IP addresses are within the specified IP address range can be managed.
If you do not specify this parameter, all servers can be managed.
Instance Quota
The number of the instances that can be managed.
Valid values: 1 to 1000. Default value: 10.
Validity Period
The validity period of the registration code. If the registration code expires and is not in use, you must create a registration code.
Valid values: 1 to 876576. Default value: 4. Unit: hours.
Description
The description of the registration code. You can enter information such as the purpose of the code for subsequent management.
Tag
The Tag key and Tag value that you want to add to the registration code. The tag value and tag key facilitate subsequent management and maintenance.
ImportantThe Tag key and Tag value parameters that you want to add to the registration code are automatically added to the managed instances that are registered with the registration code.
Resource Group
The resource group to which the managed instances are added. The resource group is used to manage the instances based on the purpose and permissions of the instances.
ImportantThe managed instances that are registered with the registration code are automatically added to the resource group that corresponds to the registration code.
If you do not specify a resource group ID, the managed instances are added to your default resource group.
Click Generate Registration Code.
Installation scripts are generated to execute on the third-party server.
Obtain the installation scripts.
Select an installation script suitable for the operating system type of your server and click Download or Copy to save the script to your computer. The installation scripts in the following formats are generated:
RPM package: applicable to operating systems such as Alibaba Cloud Linux, CentOS, RHEL, and SUSE Linux.
DEB package: applicable to operating systems such as Debian and Ubuntu.
EXE package: applicable to Windows Server operating systems.
ImportantAfter the registration code is generated, the installation scripts are displayed only once. You must save the suitable installation scripts to your computer.
If your servers run multiple operating systems, download the installation scripts that are suitable for the operating systems.
Step 2: Install Cloud Assistant Agent on a server and register the server as a managed instance
You must install Cloud Assistant Agent on your third-party server. Then, register the server as a managed instance by using the installation script that is generated when you created the registration code.
Linux servers
A server can directly access the Internet
Log on to your third-party server.
Create an installation script on the server.
Run the following command to create a script by using the Vim editor:
vim installAssistant.sh
Press the
I
key to enter the Insert mode.Copy and paste the script obtained in Step 7 to the Vim editor.
You can add the
tag
parameter in the script to specify tags for the managed instance. Use the following syntax to configure the tag parameter:--tag key=tag value
. Up to 20 tags can be specified. Separate the tags with spaces. For example, if you add--tag ECS=Document Test=demo
to the script, tag A (ECS:Document) and tag B (Test:demo) are added to the managed instance.ImportantTake note of the following items when you add tags to the managed instance:
If you use the
tag
parameter to specify tags for the managed instance in the script that was generated in the ECS console, the specified tags are added to the managed instance, regardless of whether the registration code that is used to register the instance has tags added.If you do not use the
tag
parameter to specify tags for the managed instance in the script and the registration code that is used to register the instance has tags added, the instance inherits the tags of the registration code. For information about the registration code, see the Step 1: Create a registration code section of this topic.If you do not specify tags in the script and the registration code that is used to register the managed instance has no tags added, no tags are added to the managed instance.
Take note of the following items about the resource group of the managed instance:
If no resource group ID is specified for the registration code when the code was created, the managed instance is added to the default resource group.
To manage permissions for the managed instance and registration code on a resource group basis, you can add required Resource Access Management (RAM) policies to the resource group to which the managed instance and registration code belong. For information about RAM policies and resource group-based permission control for managed instances, see the Managed instance-specific sample custom policies section in the "Use RAM to implement permission control" topic and Classify resources into resource groups and grant permissions on the resource groups.
Press the
Esc
key and enter:wq
to save the script and exit the Vim editor.
Run the following command to grant execution permissions on the installation script:
sudo chmod 755 installAssistant.sh
Run the following command to install Cloud Assistant Agent on the server:
sudo ./installAssistant.sh
If Cloud Assistant Agent is installed, a command output similar to the following output is returned.
A server uses a proxy server to access the Internet
In this example, a server that runs Cent OS 7.8 is used. The following section describes how to use a proxy server to install Cloud Assistant Agent and register a managed instance.
During the operation, use the script generated in Step 6. The following sample script is provided for the server that runs CentOS 7.8.
If the server runs an operating system such as Debian, modify the corresponding commands in the installation script generated in Step 7.
①: Download the Cloud Assistant Agent installation package.
②: Install Cloud Assistant Agent.
③: Register the server as an instance managed by Cloud Assistant.
Log on to the server by using SSH.
For more information, see Connect to an instance.
Run the following command to use the proxy server to download Cloud Assistant Agent:
sudo https_proxy=<http://your_proxy_address> && wget https://aliyun-client-assist.oss-accelerate.aliyuncs.com/linux/aliyun_assist_latest.rpm
ImportantYou must replace
<http://your_proxy_address>
with the IP address of your proxy server.Run the following command to install Cloud Assistant Agent on the server:
sudo rpm -ivh aliyun_assist_latest.rpm --force
Configure a proxy server for Cloud Assistant.
Modify the Cloud Assistant service configuration file.
Modify the Cloud Assistant service configuration file and configure the ALIYUN_ASSIST_PROXY environment variable. Perform the following steps:
Create the vim /etc/sysconfig/aliyun file by using the Vim editor.
sudo vim /etc/sysconfig/aliyun
Enter the following content. Then, save and close the file.
ALIYUN_ASSIST_PROXY=<http://your_proxy_address>
ImportantYou must replace
<http://your_proxy_address>
with the IP address of your proxy server.
Run the following command to reload the systemd configuration:
sudo systemctl daemon-reload
Run the following command to restart Cloud Assistant:
sudo systemctl restart aliyun.service
After Cloud Assistant is started, if a proxy server is created for Cloud Assistant,
Detected environment variable ALIYUN_ASSIST_PROXY for proxy setting
appears in the logs of Cloud Assistant. The default log path is /usr/local/share/aliyun-assist/{version}/log/aliyun_assist_main.log.
Register the server as an instance managed by Cloud Assistant by using the proxy server.
Run the following command to configure the proxy server:
sudo export ALIYUN_ASSIST_PROXY=<http://your_proxy_address>
ImportantYou must replace
<http://your_proxy_address>
with the IP address of your proxy server.Run the following commands to register the server as an instance managed by Cloud Assistant.
ImportantThe following example is provided for reference only. You must replace the code with the code that is generated in Step 6.
sudo aliyun-service --register --RegionId "cn-hangzhou" \ --ActivationCode "a-hz0f5KlGmF/TsM5uBuq7Eqor+****" \ --ActivationId "045CE381-0404-4F42-A44B-CC232B3E****"
A server is connected to a virtual private cloud (VPC) by using Express Connect
In this example, a server that runs CentOS is used. The following section describes how to install Cloud Assistant Agent by using Express Connect and register a managed instance in a VPC.
During the operation, use the values of RegionId
, ActivationCode
, and ActivationId
in the script generated in Step 6. The following sample script is provided for the server that runs CentOS 7.8.
If the server runs a Debian operating system, you must modify the commands based on the installation script generated in Step 6.
Log on to the server by using SSH.
For more information, see Connect to an instance.
Run the following script to register a managed instance in a VPC:
Windows servers
A server can directly access the Internet
Log on to the server by using Remote Desktop Connection.
For more information, see Connect to an instance.
Upload the installation script to the server.
The installation script is generated in Step 7 when you created a registration code.
NoteRemote Desktop Connection allows you to copy and paste the script file directly to the server. If the script file cannot be copied due to network environment limits, upload the script file by using software such as File Transfer Protocol (FTP).
Right-click the installation script and click Run with PowerShell to start the installation of Cloud Assistant Agent.
A server uses a proxy server to access the Internet
In this example, a server that runs Windows Server 2016 Datacenter is used. The following section describes how to use a proxy server to install Cloud Assistant Agent and register a managed instance.
When you configure the proxy server, use the values of RegionId
, ActivationCode
, and ActivationId
in the script generated in Step 6. The following sample code is used.
Log on to the server by using Remote Desktop Connection.
For more information, see Connect to an instance.
Configure a proxy server for the browser.
Choose .
Click Network and Internet.
Click Network and Sharing Center.
In the lower-left corner of the page that appears, click Internet Options.
Click the Connections tab and click LAN settings.
In the Proxy server section of the Local Area Network (LAN) Settings dialog box, configure the address and port of the proxy server and then click OK.
Download the Cloud Assistant Agent installation package.
Click Start and choose .
Right-click Windows PowerShell and select Run as administrator.
In the Windows PowerShell dialog box, run the following command to download the Cloud Assistant Agent installation package:
Invoke-WebRequest -Uri 'https://aliyun-client-assist.oss-accelerate.aliyuncs.com/windows/aliyun_agent_latest_setup.exe' -OutFile 'C:\\aliyun_agent_latest_setup.exe'
Install Cloud Assistant Agent.
Open the C:\ drive.
Double-click aliyun_agent_latest_setup.exe and follow the installation wizard to install Cloud Assistant Agent.
Configure a proxy server for Cloud Assistant.
Choose .
Click System and Security.
Click System.
In the left-side navigation pane, click Advanced system settings.
Click the Advanced tab and click Environment Variables.
In the System variables section, click New.
Configure Variable name and Variable value and click OK.
Variable name: Set this parameter to ALIYUN_ASSIST_PROXY.
Variable value: Set this parameter to the IP address of your proxy server.
Restart Cloud Assistant in Windows PowerShell.
Run the following command to stop Cloud Assistant:
net stop AliyunService
Run the following command to restart Cloud Assistant:
net start AliyunService
Use the proxy server to register an instance managed by Cloud Assistant in Windows PowerShell.
Run the following command to go to the directory where Cloud Assistant Agent is installed:
cd C:\ProgramData\aliyun\assist\{version}
Important{version}
specifies the version of Cloud Assistant Agent. Set this value to a specific version number.Run the following command to register the Windows server as an instance managed by Cloud Assistant:
The following sample command is used. You must replace the values of
RegionId
,ActivationCode
, andActivationId
with the values in the script generated in Step 6..\aliyun_assist_service.exe --register --RegionId="cn-hangzhou" --ActivationCode="a-hz0f6dB8Fg6hhtK0A5n9xqqdH****" --ActivationId="0A2E5ECE-5C71-4FA3-807B-05962C25****"
A server is connected to a VPC of Alibaba Cloud by using Express Connect
In this example, a server that runs Windows Server 2016 Datacenter is used. The following section describes how to use Express Connect to install Cloud Assistant Agent and register a managed instance.
You must replace the values of RegionId
, ActivationCode
, and ActivationId
with the values in the script generated in Step 6. The following sample code is used:
Log on to the server by using Remote Desktop Connection.
For more information, see Connect to an instance.
Click Start and choose .
Right-click Windows PowerShell and select Run as administrator.
In the Windows PowerShell dialog box, run the following command.
The following sample command is used. You must replace the values of
RegionId
,ActivationCode
, andActivationId
with the values in the script generated in Step 6.$RegionId = "cn-hangzhou"$Bucket = "aliyun-client-assist-${RegionId}.oss-${RegionId}-internal.aliyuncs.com"Invoke-WebRequest -Uri "https://${Bucket}/windows/aliyun_agent_latest_setup.exe" `-OutFile 'C:\\aliyun_agent_latest_setup.exe'&"C:\\aliyun_agent_latest_setup.exe" '/S' '--register' `'--NetworkMode="vpc"' '--RegionId="cn-hangzhou"' `'--ActivationCode="a-hz0f6dB8Fg6hhtK0A5n9xqqdH****"' `'--ActivationId="0A2E5ECE-5C71-4FA3-807B-05962C25****"'type C:\ProgramData\aliyun\assist\hybrid\instance-idStart-Sleep -s 30net stop AliyunServicenet start AliyunService
Step 3: Verify that the third-party server is managed by Alibaba Cloud
After you install Cloud Assistant Agent on the server and register the instance, go back to the ECS console to check whether the managed instance is connected as expected. If the managed instance is connected, the third-party server is successfully managed.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
On the ECS Cloud Assistant page, click the Manage Instances tab to view the list of managed instances.
By default, all resources under the current Alibaba Cloud account are displayed. In the upper-left corner of the ECS Cloud Assistant page, you can select a resource group from the All Resources drop-down list to view the managed instances and registration codes in the selected resource group.
If the server is registered as a managed instance, Normal is displayed in the Connection Status column corresponding to the managed instance, as shown in the preceding figure.
After your third-party server is registered as a managed instance, you can use Cloud Assistant to manage the server without the need to log on to the server. For information about how to use Cloud Assistant, see Create and run a command and Use Cloud Assistant to upload a file to ECS instances.
(Optional) Deregister managed instances
If you no longer want to use Alibaba Cloud to manage a third-party server, deregister the managed instance and then stop and uninstall Cloud Assistant.
Linux servers
Log on to the server by using SSH.
For more information, see Connect to an instance.
Run the following command to deregister the managed instance:
sudo aliyun-service --deregister
Stop and uninstall the Cloud Assistant daemon process.
Run the following command to stop the Cloud Assistant daemon process:
sudo /usr/local/share/assist-daemon/assist_daemon --stop
NoteIn the preceding command, /usr/local/share/assist-daemon/assist_daemon is the default path of the Cloud Assistant daemon process.
Run the following command to uninstall the Cloud Assistant daemon process:
sudo /usr/local/share/assist-daemon/assist_daemon --delete
Run the following command to stop Cloud Assistant Agent.
NoteThe initialization process service used by the server varies based on the version of the Linux kernel. Linux that runs a recent kernel version (such as Ubuntu 18.04) generally uses the systemd initialization process service. In this example, the systemd initialization process service is used. For information about how to use other initialization process services, see Start, stop, or uninstall Cloud Assistant Agent.
sudo systemctl stop aliyun.service
Run one of the following commands to uninstall Cloud Assistant Agent:
RPM package:
sudo rpm -qa | grep aliyun_assist | xargs sudo rpm -e
DEB package:
sudo dpkg -r aliyun_assist_latest.deb
Delete the Cloud Assistant daemon process and Cloud Assistant Agent.
Run the following command to delete the directory in which the Cloud Assistant daemon process is stored:
sudo rm -rf /usr/local/share/assist-daemon
Run the following command to delete the directory in which Cloud Assistant Agent is installed:
sudo rm -rf /usr/local/share/aliyun-assist
Windows servers
In this example, a server that runs Windows Server 2019 is used. The paths for Windows PowerShell and services vary based on the Windows version.
Log on to the server by using Remote Desktop Connection.
For more information, see Connect to an instance.
Run Windows PowerShell.
Click Start.
Choose
.Right-click Windows PowerShell and select Run as administrator.
Run the following command in Windows PowerShell to deregister the managed instance:
aliyun-service --deregister
Open the service management window.
Click Start.
Choose
.
Find Aliyun Assist Service and click Stop the service.
References
After you register a managed instance, you can use various online services provided by Alibaba Cloud, such as Cloud Assistant, CloudOps Orchestration Service, and Apsara Devops.
Cloud Assistant: You can use Cloud Assistant to automate O&M scripts, poll processes, install and uninstall software, start or stop services, install patches, and install security updates. For more information, see Use Cloud Assistant.
CloudOps Orchestration Service: You can use CloudOps Orchestration Service to automatically manage and execute O&M tasks. For more information, see Use OOS to manage ECS.
You can also call the following API operations to manage activation codes and managed instances: