Prerequisites
The instance types and operating systems of the instances on which you want to install Cloud Assistant Agent support Cloud Assistant. For more information, see the Limits section in the "Overview" topic.
Background information
By default, Cloud Assistant Agent is pre-installed on ECS instances that are created from public images on or after December 1, 2017.
For ECS instances created before December 1, 2017, you must manually install Cloud Assistant Agent.
Note
After you register a server that is not provided by Alibaba Cloud as an Alibaba Cloud managed instance, you can use various online services of Alibaba Cloud, such as Cloud Assistant, CloudOps Orchestration Service (OOS), and Apsara Devops, on the managed instance. For more information, see Alibaba Cloud managed instances.
Install a version of Cloud Assistant Agent based on the features supported by Cloud Assistant. The following table describes the features that are supported by Cloud Assistant and the earliest supported version of Cloud Assistant Agent for each feature.
Feature supported by Cloud Assistant | Earliest supported version of Cloud Assistant Agent for Linux instances | Earliest supported version of Cloud Assistant Agent for Windows instances | References |
Feature supported by Cloud Assistant | Earliest supported version of Cloud Assistant Agent for Linux instances | Earliest supported version of Cloud Assistant Agent for Windows instances | References |
Report Cloud Assistant heartbeats | 1.0.2.458 | 1.0.0.149 | N/A |
Send files | 1.0.2.569 | 1.0.0.149 | Use Cloud Assistant to upload a file to ECS instances |
Specify a username to use to run a command | 2.2.0.106 | 2.1.0.50 | |
Configure a command to run on next instance startup | 2.2.0.46 | 2.1.0.50 |
Configure a command to run on every instance startup |
Session Manager | 2.2.3.196 | 2.1.3.196 | Connect to an instance by using Session Manager |
Use a rate expression or an at expression in the execution plan of a scheduled task | 2.2.3.282 | 2.1.3.282 | |
Specify a cron expression that includes a <Year> field or a <Time zone> field in the execution plan of a scheduled task | 2.2.3.282 | 2.1.3.282 |
Specify built-in environment parameters | 2.2.3.309 | 2.1.3.309 | |
Use instance names as built-in environment parameters | 2.2.3.344 | 2.1.3.344 |
Use specific exit codes to stop or restart instances | 2.2.3.317 | 2.1.3.317 | Run a Cloud Assistant command to stop or restart instances |
Specify the name of a container in which to run a command | 2.2.3.344 | 2.1.3.344 | Use Cloud Assistant to run commands in containers |
Specify the ID of a container in which to run a command | 2.2.3.344 | 2.1.3.344 |
The following table describes the methods that you can use to install Cloud Assistant Agent on different operating systems.
Operating system | Installation method |
Operating system | Installation method |
Windows operating systems | |
Linux operating systems such as Alibaba Cloud Linux, CentOS, Red Hat Enterprise Linux (RHEL), SUSE Linux, Debian, and Ubuntu | |
FreeBSD operating systems | |
Other Linux operating systems | |
Install Cloud Assistant Agent on a Windows instance
Connect to a Windows instance as an administrator.
Download Cloud Assistant Agent.
You can download a specific version of Cloud Assistant Agent from one of the following URLs:
Public URL for the latest version of Cloud Assistant Agent:
Public URL for a specific version of Cloud Assistant Agent:
https://aliyun-client-assist.oss-accelerate.aliyuncs.com/windows/aliyun_agent_{version}_setup.exe
Internal URL for the latest version of Cloud Assistant Agent:
https://aliyun-client-assist-{regionId}.oss-{regionId}-internal.aliyuncs.com/windows/aliyun_agent_latest_setup.exe
Internal URL for a specific version of Cloud Assistant Agent:
https://aliyun-client-assist-{regionId}.oss-{regionId}-internal.aliyuncs.com/windows/aliyun_agent_{version}_setup.exe
Note
{version} indicates the version number of Cloud Assistant Agent.
{regionId} indicates the region ID of the instance on which you want to install Cloud Assistant Agent.
To query the region in which an instance resides, click the ID of the instance on the instance list page in the ECS console and view the value of the Region parameter in the Basic Information section of the Instance Details page. Then, you can query the ID of the region in the Regions and zones topic.
You can specify the following version numbers of Cloud Assistant Agent to download Cloud Assistant Agent from public or internal URLs:
Version numbers that can be specified in public URLs: 1.0.0.128, 2.1.2.181, 2.1.3.187, 2.1.3.221, 2.1.3.247, 2.1.3.256, 2.1.3.269, 2.1.3.282, 2.1.3.289, 2.1.3.326, 2.1.3.349, 2.1.3.372, and 2.1.3.398
Version numbers that can be specified in internal URLs: 1.0.0.128, 2.1.3.221, 2.1.3.247, 2.1.3.256, 2.1.3.265, 2.1.3.269, 2.1.3.282, 2.1.3.289, 2.1.3.326, 2.1.3.349, 2.1.3.372, and 2.1.3.398
For example, to download version 1.0.0.128 of Cloud Assistant Agent in the China (Hangzhou) region, access the following internal URL:
https://aliyun-client-assist-cn-hangzhou.oss-cn-hangzhou-internal.aliyuncs.com/windows/aliyun_agent_1.0.0.128_setup.exe
Double-click the installation file of Cloud Assistant Agent. Then, install Cloud Assistant Agent as instructed.
For Windows instances, the default installation directory of Cloud Assistant Agent is C:\ProgramData\aliyun\assist\.
You can also integrate the preceding download and installation steps into a PowerShell script. The following sample code provides an example of a PowerShell script that is used to download and install the latest version of Cloud Assistant Agent from an internal URL. Replace {regionId}
with the ID of the region in which the ECS instance resides.
curl -UseBasicParsing -Uri https://aliyun-client-assist-{regionId}.oss-{regionId}-internal.aliyuncs.com/windows/aliyun_agent_latest_setup.exe -OutFile 'C:\\aliyun_agent_latest_setup.exe'
&"C:\\aliyun_agent_latest_setup.exe" '/S'
(Optional) If the network type of the ECS instance is classic network, perform the following steps:
In the directory where Cloud Assistant Agent is installed, create a file named region-id. Do not add an extension, such as .txt or .conf, to the file name.
Important
In Windows, you must clear "Hide extensions for known file types" before you can check whether the region-id file has an extension.
In the region-id file, enter the region ID of the instance. Example: cn-hangzhou.
Note
To query the region in which an instance resides, click the ID of the instance on the instance list page in the ECS console and view the value of the Region parameter in the Basic Information section of the Instance Details page. Then, you can query the ID of the region in the Regions and zones topic.
For example, the instance runs a Windows Server 2012 R2 operating system and resides in the China (Hangzhou) region whose ID is cn-hangzhou. The default installation directory of Cloud Assistant Agent on the instance is C:\ProgramData\aliyun\assist\. You must create the region-id file in the directory and enter cn-hangzhou in the file, as shown in the following figure.![在Windows上添加文件](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/6432894761/p539063.png)
Install Cloud Assistant Agent on a Linux instance
Use RPM or DEB packages
FreeBSD
Use binary packages
Use source code
This installation method is applicable to Linux operating systems such as Alibaba Cloud Linux, CentOS, RHEL, SUSE Linux, Debian, and Ubuntu.
Use a user that has sudo permissions to connect to a Linux instance.
Run the following script to download and install the Cloud Assistant Agent installation package.
Important
By default, the latest version of Cloud Assistant Agent is installed by using the following script. If you want to install a specific version of Cloud Assistant Agent, change latest in the VERSION=latest
line to the number of the version that you want to install, such as 2.2.3.398 (VERSION=2.2.3.398
). The following versions are available:
x86 architecture: 2.2.0.102, 2.2.0.106, 2.2.2.181, 2.2.3.187, 2.2.3.221, 2.2.3.247, 2.2.3.256, 2.2.3.269, 2.2.3.282, 2.2.3.289, 2.2.3.326, 2.2.3.349, 2.2.3.372, and 2.2.3.398
Arm architecture: 2.4.3.282, 2.4.3.326, 2.4.3.349, 2.4.3.372, and 2.4.3.398
Download the installation script over the internal network
Download the installation script over the Internet
We recommend that you use this method. By default, an ECS instance can download scripts over the internal network.
#!/bin/bash
VERSION=latest
PACKAGE=
PKG_URI=
REGION=$(curl http://100.100.100.200/latest/meta-data/region-id)
DOMAIN=aliyun-client-assist-${REGION}.oss-${REGION}-internal.aliyuncs.com
arch=$(uname -m)
echo "[main] arch = ${arch}"
case $arch in
"i386"|"i686"|"x86_64"|"amd64")
if command -v rpm; then
PACKAGE="aliyun_assist_${VERSION}.rpm"
else
PACKAGE="aliyun_assist_${VERSION}.deb"
fi
PKG_URI="https://$DOMAIN/linux/$PACKAGE"
;;
*)
if command -v rpm; then
PACKAGE="aliyun-assist-${VERSION}-1.aarch64.rpm"
else
PACKAGE="aliyun-assist-${VERSION}-1_arm64.deb"
fi
PKG_URI="https://$DOMAIN/arm/$PACKAGE"
esac
if command -v wget; then
sudo wget $PKG_URI
elif command -v curl; then
curl -o $PACKAGE $PKG_URI
else
echo "[WARN] command wget/curl not found, exit"
exit 1;
fi;
if command -v rpm; then
sudo rpm -ivh --force $PACKAGE
elif command -v dpkg; then
sudo dpkg -i $PACKAGE
else
echo "[WARN] command rpm/dpkg not found, exit"
exit 2;
fi
if [[ -e /etc/redhat-release ]]; then
if sudo systemctl status qemu-guest-agent; then
sudo systemctl stop qemu-guest-agent
sudo systemctl disable qemu-guest-agent
sudo systemctl restart aliyun.service
fi
fi
This method is applicable to hosts that are not provided by Alibaba Cloud and Alibaba Cloud ECS instances that can access the Internet.
#!/bin/bash
VERSION=latest
PACKAGE=
PKG_URI=
DOMAIN=aliyun-client-assist.oss-accelerate.aliyuncs.com
arch=$(uname -m)
echo "[main] arch = ${arch}"
case $arch in
"i386"|"i686"|"x86_64"|"amd64")
if command -v rpm; then
PACKAGE="aliyun_assist_${VERSION}.rpm"
else
PACKAGE="aliyun_assist_${VERSION}.deb"
fi
PKG_URI="https://$DOMAIN/linux/$PACKAGE"
;;
*)
if command -v rpm; then
PACKAGE="aliyun-assist-${VERSION}-1.aarch64.rpm"
else
PACKAGE="aliyun-assist-${VERSION}-1_arm64.deb"
fi
PKG_URI="https://$DOMAIN/arm/$PACKAGE"
esac
if command -v wget; then
sudo wget $PKG_URI
elif command -v curl; then
curl -o $PACKAGE $PKG_URI
else
echo "[WARN] command wget/curl not found, exit"
exit 1;
fi;
if command -v rpm; then
sudo rpm -ivh --force $PACKAGE
elif command -v dpkg; then
sudo dpkg -i $PACKAGE
else
echo "[WARN] command rpm/dpkg not found, exit"
exit 2;
fi
if [[ -e /etc/redhat-release ]]; then
if sudo systemctl status qemu-guest-agent; then
sudo systemctl stop qemu-guest-agent
sudo systemctl disable qemu-guest-agent
sudo systemctl restart aliyun.service
fi
fi
Use a user that has sudo permissions to connect to a Linux instance.
Run the following script to download and install the Cloud Assistant Agent installation package.
Important
By default, the latest version of Cloud Assistant Agent is installed by using the following script. If you want to install a specific version of Cloud Assistant Agent, change latest in the VERSION=latest
line to the number of the version that you want to install, such as 2.2.3.398 (VERSION=2.2.3.398
). The following versions are available: 2.3.3.529, 2.3.3.704, and 2.3.3.857.
FreeBSD 11 supports only version 2.3.3.529.
Download the installation script over the internal network
Download the installation script over the Internet
We recommend that you use this method. By default, an ECS instance can download scripts over the internal network.
#!/bin/sh
VERSION=latest
use_curl=0
which curl >/dev/null 2>&1 && use_curl=1
if [ $use_curl -eq 1 ];then
REGION=$(curl http://100.100.100.200/latest/meta-data/region-id)
else
REGION=$(wget -O - http://100.100.100.200/latest/meta-data/region-id)
fi
DOMAIN=aliyun-client-assist-${REGION}.oss-${REGION}-internal.aliyuncs.com
PACKAGE=aliyun_assist_${VERSION}.txz
PKG_URI="https://$DOMAIN/freebsd/$PACKAGE"
if [ $use_curl -eq 1 ];then
curl -o $PACKAGE $PKG_URI
else
wget -O $PACKAGE $PKG_URI
fi
pkg install -U -y $PACKAGE
service aliyun start
This method is applicable to hosts that are not provided by Alibaba Cloud and Alibaba Cloud ECS instances that can access the Internet.
#!/bin/sh
VERSION=latest
DOMAIN=aliyun-client-assist.oss-accelerate.aliyuncs.com
PACKAGE=aliyun_assist_${VERSION}.txz
PKG_URI="https://$DOMAIN/freebsd/$PACKAGE"
use_curl=0
which curl >/dev/null 2>&1 && use_curl=1
if [ $use_curl -eq 1 ];then
curl -o $PACKAGE $PKG_URI
else
wget -O $PACKAGE $PKG_URI
fi
pkg install -U -y $PACKAGE
service aliyun start
This installation method is applicable to mainstream Linux operating systems.
Use a user that has sudo permissions to connect to a Linux instance.
Run the following script to download and install the Cloud Assistant Agent installation package.
Important
By default, the latest version of Cloud Assistant Agent is installed by using the following script. If you want to install a specific version of Cloud Assistant Agent, change latest in the VERSION=latest
line to the number of the version that you want to install, such as 2.2.3.398 (VERSION=2.2.3.398
). The following versions are available:
x86 architecture: 2.2.3.282, 2.2.3.289, 2.2.3.326, 2.2.3.349, 2.2.3.372, and 2.2.3.398
Arm architecture: 2.4.3.282, 2.4.3.326, 2.4.3.349, 2.4.3.372, and 2.4.3.398
Download the installation script over the internal network
Download the installation script over the Internet
We recommend that you use this method. By default, an ECS instance can download scripts over the internal network.
#!/bin/bash
VERSION=latest
PACKAGE=
PKG_URI=
REGION=$(curl http://100.100.100.200/latest/meta-data/region-id)
DOMAIN=aliyun-client-assist-${REGION}.oss-${REGION}-internal.aliyuncs.com
arch=$(uname -m)
echo "[main] arch = ${arch}"
case $arch in
"i386"|"i686"|"x86_64"|"amd64")
PACKAGE="aliyun_assist_${VERSION}.deb"
PKG_URI="https://$DOMAIN/linux/$PACKAGE"
;;
*)
PACKAGE="aliyun-assist-${VERSION}-1_arm64.deb"
PKG_URI="https://$DOMAIN/arm/$PACKAGE"
esac
if command -v wget; then
sudo wget $PKG_URI
elif command -v curl; then
curl -o $PACKAGE $PKG_URI
else
echo "[WARN] command wget/curl not found, exit"
exit 1
fi;
TARGET_DIR=/usr/local/share/aliyun-assist
sudo unzip -o $PACKAGE -d $TARGET_DIR/
sudo chmod a+x $TARGET_DIR/$VERSION/update_install
sudo bash $TARGET_DIR/$VERSION/update_install
This method is applicable to hosts that are not provided by Alibaba Cloud and Alibaba Cloud ECS instances that can access the Internet.
#!/bin/bash
VERSION=latest
PACKAGE=
PKG_URI=
DOMAIN=aliyun-client-assist.oss-accelerate.aliyuncs.com
arch=$(uname -m)
echo "[main] arch = ${arch}"
case $arch in
"i386"|"i686"|"x86_64"|"amd64")
PACKAGE="aliyun_assist_${VERSION}_update.zip"
PKG_URI="https://$DOMAIN/linux/$PACKAGE"
;;
*)
PACKAGE="aliyun-assist-${VERSION}-update_arm.zip"
PKG_URI="https://$DOMAIN/arm/$PACKAGE"
esac
if command -v wget; then
sudo wget $PKG_URI
elif command -v curl; then
curl -o $PACKAGE $PKG_URI
else
echo "[WARN] command wget/curl not found, exit"
exit 1
fi;
TARGET_DIR=/usr/local/share/aliyun-assist
sudo unzip -o $PACKAGE -d $TARGET_DIR/
sudo chmod a+x $TARGET_DIR/$VERSION/update_install
sudo bash $TARGET_DIR/$VERSION/update_install
Use a user that has sudo permissions to connect to a Linux instance.
Install required software, such as Git and Go.
In this example, Yellowdog Updater, Modified (YUM) is used. If you use other Linux operating systems, use the corresponding package manager.
Download the source code for Cloud Assistant Agent.
sudo git clone https://github.com/aliyun/aliyun_assist_client
Go to the directory in which the source code is stored.
cd ./aliyun_assist_client
Compile the source code.
If no error message is returned, Cloud Assistant Agent is installed.
If the ECS instance resides in the classic network, perform the following operations:
In the directory where Cloud Assistant Agent is installed, create a file named region-id and enter the region ID of the instance in the file. For example, to create the region-id file in the default installation directory and enter the region ID of the instance on which Cloud Assistant Agent is installed in the file, run one of the following commands based on the operating system of the instance.
CoreOS operating systems:
sudo sh -c 'echo "cn-hangzhou" > /opt/local/share/aliyun-assist/region-id'
Other Linux operating systems, such as Alibaba Cloud Linux, Ubuntu, Debian, Red Hat, SUSE Linux Enterprise Server, and openSUSE:
sudo sh -c 'echo "cn-hangzhou" > /usr/local/share/aliyun-assist/region-id'
If the sudo sh -c 'echo "cn-hangzhou" > /usr/local/share/aliyun-assist/region-id command is run, the following command output is returned.![创建文件](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3647021861/p539178.png)
Run Cloud Assistant Agent.
Install Cloud Assistant Agent on Windows or Linux instances by using Alibaba Cloud CLI
To use this method, you do not need to connect to an instance but you must install Alibaba Cloud CLI on your on-premises computer. For information about how to install Alibaba Cloud CLI on different operating systems, see the following topics:
Note
You cannot use Alibaba Cloud CLI to install Cloud Assistant Agent on RHEL.
Call the DescribeCloudAssistantStatus operation to check whether Cloud Assistant Agent is installed on your instance.
aliyun ecs DescribeCloudAssistantStatus --RegionId TheRegionId --InstanceId.1 i-bp1g6zv0ce8og******p --output cols=CloudAssistantStatus rows=InstanceCloudAssistantStatusSet.InstanceCloudAssistantStatus[]
If the value of the CloudAssistantStatus
parameter is true in the response, Cloud Assistant Agent is installed on the instance. If the value of the CloudAssistantStatus parameter is false in the response, proceed to the next step.
Call the InstallCloudAssistant operation to install Cloud Assistant Agent.
aliyun ecs InstallCloudAssistant --RegionId TheRegionId --InstanceId.1 i-bp1g6zv0ce8og******p
Call the RebootInstance operation to restart the instance.
aliyun ecs RebootInstance --InstanceId i-bp1g6zv0ce8og******p
If the instance is in the classic network, add a region declaration within the instance.
Connect to the ECS instance as the root user or an administrator.
View the version of Cloud Assistant Agent.
If the version of Cloud Assistant Agent is later than 1.0.1.400, Cloud Assistant Agent is installed on the instance. If the version of Cloud Assistant Agent is 1.0.1.400 or earlier, proceed to the next step.
Create the region-id file and enter the region ID of the instance in the file.
In the directory where Cloud Assistant Agent is installed, create a file named region-id and enter the region ID of the instance in the file. For example, to create the region-id file in the default installation directory and enter the region ID of the instance on which Cloud Assistant Agent is installed in the file, run one of the following commands based on the operating system of the instance.
CoreOS operating systems:
sudo sh -c 'echo "cn-hangzhou" > /opt/local/share/aliyun-assist/region-id'
Other Linux operating systems, such as Alibaba Cloud Linux, Ubuntu, Debian, Red Hat, SUSE Linux Enterprise Server, and openSUSE:
sudo sh -c 'echo "cn-hangzhou" > /usr/local/share/aliyun-assist/region-id'
If the sudo sh -c 'echo "cn-hangzhou" > /usr/local/share/aliyun-assist/region-id command is run, the following command output is returned.![创建文件](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3647021861/p539178.png)
In the directory where Cloud Assistant Agent is installed, create a file named region-id. Do not add an extension, such as .txt or .conf, to the file name.
Important
In Windows, you must clear "Hide extensions for known file types" before you can check whether the region-id file has an extension.
In the region-id file, enter the region ID of the instance. Example: cn-hangzhou.
Note
To query the region in which an instance resides, click the ID of the instance on the instance list page in the ECS console and view the value of the Region parameter in the Basic Information section of the Instance Details page. Then, you can query the ID of the region in the Regions and zones topic.
For example, the instance runs a Windows Server 2012 R2 operating system and resides in the China (Hangzhou) region whose ID is cn-hangzhou. The default installation directory of Cloud Assistant Agent on the instance is C:\ProgramData\aliyun\assist\. You must create the region-id file in the directory and enter cn-hangzhou in the file, as shown in the following figure.![在Windows上添加文件](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/6432894761/p539063.png)
View information about Cloud Assistant Agent on an ECS instance
After you install Cloud Assistant Agent on an ECS instance, you can perform the following steps to query the version number and status of Cloud Assistant Agent:
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
Click the ECS Instances tab to view information about Cloud Assistant Agent on the ECS instances in the current region.
Latest versions of Cloud Assistant Agent supported by specific kernel versions
Kernel version | Latest version of Cloud Assistant Agent supported by the kernel version |
Kernel version | Latest version of Cloud Assistant Agent supported by the kernel version |
Linux kernel version earlier than 2.6.32 | |
Kernel version earlier than 12.x in FreeBSD 11 or earlier | 2.3.3.529 |