This topic describes how to register a server that is not provided by Alibaba Cloud as an Alibaba Cloud managed instance. After a server is registered as a managed instance, the server can use various online services provided by Alibaba Cloud such as Cloud Assistant, CloudOps Orchestration Service, and Alibaba Cloud DevOps.
Prerequisites
The server runs an operating system of one of the following versions:
Alibaba Cloud Linux 2 and Alibaba Cloud Linux 3 and later
CentOS 6, CentOS 7, and CentOS 8 and later
CoreOS
Debian 8, Debian 9, and Debian 10 and later
OpenSUSE
RedHat 5, RedHat 6, and RedHat 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.
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.
NoteYou can go to the Cloud Assistant page in Elastic Compute Service (ECS) console and click Register Instance on the Manage Instances tab to view the usage of activation codes.
Preparations
We recommend that you select the region where the network is connected at the fastest speed.
The managed instance feature is supported 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), Singapore, Japan (Tokyo), US (Silicon Valley), and US (Virginia).
The managed instance feature is provided by Alibaba Cloud free of charge.
You can run the Ping command to test the connection speed and then select the region where your server is connected at the fastest speed.
Run the following command to test the connection between the server and ECS in the China (Beijing) region:
ping -c 4 cn-beijing.axt.aliyuncs.com
Run the following command to test the connection between the server and ECS in the China (Hangzhou) region:
ping -c 4 cn-hangzhou.axt.aliyuncs.com
Run the following command to test the connection between the server and ECS in the China (Shanghai) region:
ping -c 4 cn-shanghai.axt.aliyuncs.com
Procedure
Perform the following operations to register your servers as managed instances based on the scenarios described in the following table.
Scenario | Procedure |
Your server can directly access the Internet. | |
Your server must have a proxy server configured to access the Internet. | |
Your server must be connected to a virtual private cloud (VPC) of Alibaba Cloud by using Express Connect circuits. |
Step 1: Create an activation code for managed instances
This section describes how to create an activation code for managed instances in the ECS console and generate an installation script.
Log on to the ECS console.
In the left-side navigation pane, choose .
In the upper-left corner of the top navigation bar, select a region.
On the Cloud Assistant page, click the Manage Instances tab.
Open the Create Registration Code panel.
If no managed instances exist in the region, click Create Registration Code.
If managed instances exist in the region, perform the following operations:
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 registered as managed instances.
Instance Quota
The number of managed instances.
Valid values: 1 to 1000. Default value: 10.
Validity Period
The validity period of the activation code. If the activation code is not used during its validity period, the code becomes invalid when the validity period ends and you must create another one.
Valid values: 1 to 24. Default value: 4. Unit: hours.
Description
The description of the activation code. You can enter information such as the purpose of the code for subsequent management.
Tag
The tag that you want to add to the activation code for subsequent classification and management. Tag Key: the key of the tag. Tag Value: the value of the tag.
ImportantAfter you specify Tag Key and Tag Value to add a tag to an activation code, the tag is automatically added to the managed instances that are registered with the activation code.
Click Generate Registration Code.
After the activation code is generated, installation scripts are generated.
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.
ImportantAfter the activation code is generated, the installation scripts are displayed only once. You must save the suitable installation scripts to your computer.
If your servers run different operating systems, you must download the corresponding installation scripts.
Step 2: Install Cloud Assistant Agent on a server and register the server as a managed instance (direct connection)
After you obtain the installation script, install Cloud Assistant Agent on your server and register the server as a managed instance. If your server can directly access the Internet, perform the following steps.
Install Cloud Assistant Agent on a Linux server and register the server as a managed instance
Log on to the server by using SSH.
For more information, see Connection method overview.
Create an installation script in 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.Paste the content of the script that was generated in the ECS console. For more information, see the Step 1: Create an activation code for managed instances section of this topic.
You can add the
tag
parameter to the script to specify tags for the managed instance. Use the following syntax to configure the tag parameter:--tag <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.Before you use this method to add tags to the managed instance, make sure that the version of Cloud Assistant Agent is not earlier than the following ones:
Linux: 2.2.3.421
Windows: 2.1.3.421
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 activation 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 activation code that is used to register the instance has tags added, the instance inherits the tags of the activation code. For more information, see the Step 1: Create an activation code for managed instances section of this topic.If you do not specify tags in the script and the activation code that is used to register the managed instance has no tags added, the instance is not added with tags.
Press the
Esc
key to exit the Insert mode.Enter
:wq
and press theEnter
key 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 the Cloud Assistant client is installed, a command output similar to the following one is returned.
Install Cloud Assistant Agent on a Windows server and register the server as a managed instance
Log on to the server by using Remote Desktop Connection.
For more information, see Connection method overview.
Upload the installation script to the server.
For information about how to obtain the installation script, see the Step 1: Create an activation code for manage instances section of this topic.
NoteRemote Desktop Connection allows you to copy and paste the script file to the server. If the script file cannot be copied due to network environment limits, you can upload scripts by using FTP or other software.
Right-click the installation script and select Run with PowerShell to install Cloud Assistant Agent.
Step 2: Install Cloud Assistant Agent on a server and register the server as a managed instance (proxy method)
After you obtain the installation script, install Cloud Assistant Agent on your server and register the server as a managed instance. If your server must use a proxy server to access the Internet, perform the following steps.
Install Cloud Assistant Agent on a Linux server and register the server as a managed instance
This section describes how to configure a proxy server. In this example, a server that runs CentOS 7.8 is used. If your server runs an operating system such as Debian, you must modify the commands shown in the following figure based on the installation script generated in the ECS console.
①: Download the Cloud Assistant Agent installation package.
②: Install Cloud Assistant Agent.
③: Register the server as an instance managed by Cloud Assistant.
If your server must use a proxy server to access the Internet, you must add the proxy server information to the commands.
Log on to the server by using SSH.
For more information, see Connection method overview.
Run the following command to download Cloud Assistant Agent by using the proxy server:
sudo https_proxy=<http://your_proxy_address> && wget https://aliyun-client-assist.oss-accelerate.aliyuncs.com/linux/aliyun_assist_latest.rpm
NoteReplace
<http://your_proxy_address>
with the address of your proxy server.Run the following command to install Cloud Assistant Agent:
sudo rpm -ivh aliyun_assist_latest.rpm --force
Configure a proxy server for Cloud Assistant.
Modify the Cloud Assistant 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 exit the file.
ALIYUN_ASSIST_PROXY=<http://your_proxy_address>
NoteReplace
<http://your_proxy_address>
with the 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.
Run the following commands to 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>
NoteReplace
<http://your_proxy_address>
with the address of your proxy server.Run the following commands to register the server as an instance managed by Cloud Assistant:
sudo aliyun-service --register --RegionId "cn-hangzhou" \ --ActivationCode "a-hz0f5KlGmF/TsM5uBuq7Eqor+****" \ --ActivationId "045CE381-0404-4F42-A44B-CC232B3E****"
NoteThe preceding commands are provided only for reference. You must copy and paste the script generated in the ECS console. For more information, see the Step 1: Create an activation code for managed instances section of this topic.
Install Cloud Assistant Agent on a Windows server and register the server as a managed instance
This section describes how to configure a proxy server. In this example, a server that runs Windows Server 2016 Datacenter is used. The installation script of Cloud Assistant Agent for a Windows server is shown in the following figure. When you configure a proxy server, the RegionId
, ActivationCode
, and ActivationId
parameters are required.
Log on to the server by using Remote Desktop Connection.
For more information, see Connection method overview.
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, specify the address and the 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 window, 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'
After the installation package is installed, 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.
Run the following commands in Windows PowerShell to restart Cloud Assistant.
Run the following command to disable Cloud Assistant:
net stop AliyunService
Run the following command to restart Cloud Assistant:
net start AliyunService
Use the proxy server to register the Windows server as 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}
Note{version}
specifies the version of Cloud Assistant Agent. Set the value to a specific version number.Run the following command to register the Windows server as an instance managed by Cloud Assistant:
.\aliyun_assist_service.exe --register --RegionId="cn-hangzhou" --ActivationCode="a-hz0f6dB8Fg6hhtK0A5n9xqqdH****" --ActivationId="0A2E5ECE-5C71-4FA3-807B-05962C25****"
NoteThe preceding code is provided for reference only. You must change the values of
RegionId
,ActivationCode
, andActivationId
to those in the script that was generated in the ECS console. For more information, see the Step 1: Create an activation code for managed instances section of this topic.
Step 2: Install Cloud Assistant Agent on a server and register the server as a managed instance by using Express Connect
If your on-premises server must use Express Connect to connect to an Alibaba Cloud virtual private cloud (VPC), you can use this method to register the server as an Alibaba Cloud managed instance. Then, you can connect the instance to the Cloud Assistant server and use Cloud Assistant features. For information about Express Connect, see What is Express Connect?
Install Cloud Assistant Agent on a Linux server and register the server as a managed instance
This section describes how to download and install Cloud Assistant Agent. In this example, a server that runs CentOS is used. The following code shows the installation script of Cloud Assistant Agent on a Linux operating system. If the server runs a Debian operating system, you must modify the command based on the installation script that was generated in the ECS console.
Log on to the server by using SSH.
For more information, see Connection method overview.
Run the following script to register the server as a managed instance by using the proxy server.
Install Cloud Assistant Agent on a Windows server and register the server as a managed instance
This section describes how to install Cloud Assistant Agent. In this example, a server that runs Windows Server 2016 Datacenter is used. The following figure shows the installation script of Cloud Assistant Agent for a Windows server.
Log on to the server by using Remote Desktop Connection.
For more information, see Connection method overview.
Click Start and choose .
Right-click Windows PowerShell and select Run as administrator.
In the Windows PowerShell window, run the following commands:
$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-id Start-Sleep -s 30 net stop AliyunService net start AliyunService
NoteThe preceding code is provided for reference only. You must change the values of
RegionId
,ActivationCode
, andActivationId
to those in the script that was generated in the ECS console. For more information, see the Step 1: Create an activation code for managed instances section of this topic.
Step 3: View the managed instance in the ECS console
After Cloud Assistant Agent is installed, go back to the ECS console to check whether the managed instance is connected.
In the left-side navigation pane, choose .
In the upper-left corner of the top navigation bar, select a region.
On the Cloud Assistant page, click the Manage Instances tab to view the list of managed instances.
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.
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 Use the immediate execution feature and Upload files to ECS instances.
(Optional) Deregister managed instances and uninstall Cloud Assistant Agent
If Cloud Assistant is no longer needed, you can deregister managed instances and stop and uninstall Cloud Assistant Agent.
Linux operating system
Log on to the server by using SSH.
For more information, see Connection method overview.
Run the following command to unregister the managed instances:
sudo aliyun-service --deregister
Disable and uninstall the Cloud Assistant daemon process.
Run the following command to disable 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.
NoteLinux has different kernel versions and uses different initialization process services. Linux that uses a recent kernel version such as Ubuntu 18.04 generally uses the systemd initialization process service. In this example, the systemd initialization process is used. For more information about how to use other initialization process services, see Start, stop, or uninstall the 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 where the Cloud Assistant daemon process is stored:
sudo rm -rf /usr/local/share/assist-daemon
Run the following command to delete the directory where Cloud Assistant Agent is installed:
sudo rm -rf /usr/local/share/aliyun-assist
Windows operating system
In this example, a server that runs Windows Service 2019 is used. The paths for Windows PowerShell and services in other Windows versions may be different.
Log on to the server by using Remote Desktop Connection.
For more information, see Connection method overview.
Start Windows PowerShell.
Click Start.
Choose
.Right-click Windows PowerShell and select Run as administrator.
Run the following command in Windows PowerShell to unregister the managed instances:
aliyun-service --deregister
Open the service management window.
Click Start.
Choose
.
Find Aliyun Assist Service and click Stop the service.