All Products
Search
Document Center

Elastic Compute Service:Alibaba Cloud managed instances

Last Updated:Sep 29, 2024

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, Australia (Sydney) Closing Down, 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.

Important
  • 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.

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Maintenance & Monitoring > Cloud Assistant.

  3. 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. 地域

    Important

    The 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
  4. 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.

      生成注册码2.png

  5. 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.

    Important

    The 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.

    Important
    • The 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.

  6. Click Generate Registration Code.

    Installation scripts are generated to execute on the third-party server. 生成脚本

  7. 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.

    Important
    • After 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

  1. Log on to your third-party server.

  2. Create an installation script on the server.

    1. Run the following command to create a script by using the Vim editor:

      vim installAssistant.sh
    2. Press the I key to enter the Insert mode.

    3. 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.

      Important
      • Take 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.

    4. Press the Esc key and enter :wq to save the script and exit the Vim editor.

  3. Run the following command to grant execution permissions on the installation script:

    sudo chmod 755 installAssistant.sh
  4. 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.linux返回结果

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.centos

Note

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.

  1. Log on to the server by using SSH.

    For more information, see Connection method overview.

  2. 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
    Important

    You must replace <http://your_proxy_address> with the IP address of your proxy server.

  3. Run the following command to install Cloud Assistant Agent on the server:

    sudo rpm -ivh aliyun_assist_latest.rpm --force
  4. Configure a proxy server for Cloud Assistant.

    1. 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:

      1. Create the vim /etc/sysconfig/aliyun file by using the Vim editor.

        sudo vim /etc/sysconfig/aliyun
      2. Enter the following content. Then, save and close the file.

        ALIYUN_ASSIST_PROXY=<http://your_proxy_address>
        Important

        You must replace <http://your_proxy_address> with the IP address of your proxy server.

    2. Run the following command to reload the systemd configuration:

      sudo systemctl daemon-reload
    3. 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.

  5. Register the server as an instance managed by Cloud Assistant by using the proxy server.

    1. Run the following command to configure the proxy server:

      sudo export ALIYUN_ASSIST_PROXY=<http://your_proxy_address>
      Important

      You must replace <http://your_proxy_address> with the IP address of your proxy server.

    2. Run the following commands to register the server as an instance managed by Cloud Assistant.

      Important

      The 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.

Note

If the server runs a Debian operating system, you must modify the commands based on the installation script generated in Step 6.

CentOS参数信息

  1. Log on to the server by using SSH.

    For more information, see Connection method overview.

  2. Run the following script to register a managed instance in a VPC:

    • CentOS operating systems

      The following sample code is provided. You must replace the values of RegionId, ActivationCode, and ActivationId with the values in the script generated in Step 6.

      #/bin/bash## Specify a region based on the geographical location of the server.regionId="cn-hangzhou"if [[ -n $regionId ]]; then    bucket="aliyun-client-assist-${regionId}.oss-${regionId}-internal.aliyuncs.com"    ## Download Cloud Assistant Agent.    wget -q https://${bucket}/linux/aliyun_assist_latest.rpm    ## Install Cloud Assistant Agent.    sudo rpm -ivh aliyun_assist_latest.rpm --forcefi## Register the server as a managed instance in a VPC. Enter the following setting to set the network type to VPC: NetworkMode "vpc" ## Copy the values of RegionId, ActivationCode, and ActivationId from the place where the registration code was created in the ECS console.sudo aliyun-service --register \  --NetworkMode "vpc" \  --RegionId "${regionId}" \  --ActivationCode "a-hz0f5KlGmF/TsM5uBuq7Eqor+****" \  --ActivationId "2C217D35-FE6C-5636-BC3C-CC480D3*****"
    • Debian and other Linux operating systems

      The following sample code is provided. You must replace the values of RegionId, ActivationCode, and ActivationId with the values in the script generated in Step 6.

      #/bin/bash## Specify a region based on the geographical location of the server.regionId="cn-hangzhou"if [[ -n $regionId ]]; then    bucket="aliyun-client-assist-${regionId}.oss-${regionId}-internal.aliyuncs.com"    ## Download Cloud Assistant Agent.    wget -q https://${bucket}/linux/aliyun_assist_latest.deb    ## Install Cloud Assistant Agent.    sudo dpkg -i aliyun_assist_latest.debfi## Register the server as a managed instance in a VPC. Enter the following setting to set the network type to VPC: NetworkMode "vpc" ## Copy the values of RegionId, ActivationCode, and ActivationId from the place where the registration code was generated in the ECS console.sudo aliyun-service --register \  --NetworkMode "vpc" \  --RegionId "${regionId}" \  --ActivationCode "a-hz0f5KlGmF/TsM5uBuq7Eqor+****" \  --ActivationId "2C217D35-FE6C-5636-BC3C-CC480D3*****"

Windows servers

A server can directly access the Internet

  1. Log on to the server by using Remote Desktop Connection.

    For more information, see Connection method overview.

  2. Upload the installation script to the server.

    The installation script is generated in Step 7 when you created a registration code.

    Note

    Remote 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).

  3. Right-click the installation script and click Run with PowerShell to start the installation of Cloud Assistant Agent.

    windows安装脚本

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. win脚本

  1. Log on to the server by using Remote Desktop Connection.

    For more information, see Connection method overview.

  2. Configure a proxy server for the browser.

    1. Choose Start > Control Panel.

    2. Click Network and Internet.

    3. Click Network and Sharing Center.

    4. In the lower-left corner of the page that appears, click Internet Options.

      代理

    5. Click the Connections tab and click LAN settings.

    6. 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.

  3. Download the Cloud Assistant Agent installation package.

    1. Click Start and choose Windows PowerShell > Windows PowerShell.

    2. Right-click Windows PowerShell and select Run as administrator.

    3. 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'
  4. Install Cloud Assistant Agent.

    1. Open the C:\ drive.

    2. Double-click aliyun_agent_latest_setup.exe and follow the installation wizard to install Cloud Assistant Agent.

  5. Configure a proxy server for Cloud Assistant.

    1. Choose Start > Control Panel.

    2. Click System and Security.

    3. Click System.

    4. In the left-side navigation pane, click Advanced system settings.

      设置代理

    5. Click the Advanced tab and click Environment Variables.

    6. In the System variables section, click New.

    7. 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.

    8. Restart Cloud Assistant in Windows PowerShell.

      1. Run the following command to stop Cloud Assistant:

        net stop AliyunService
      2. Run the following command to restart Cloud Assistant:

        net start AliyunService
  6. Use the proxy server to register an instance managed by Cloud Assistant in Windows PowerShell.

    1. 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.

    2. 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, and ActivationId 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:

win脚本

  1. Log on to the server by using Remote Desktop Connection.

    For more information, see Connection method overview.

  2. Click Start and choose Windows PowerShell > Windows PowerShell.

  3. Right-click Windows PowerShell and select Run as administrator.

  4. In the Windows PowerShell dialog box, run the following command.

    The following sample command is used. You must replace the values of RegionId, ActivationCode, and ActivationId 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.

  1. In the left-side navigation pane, choose Maintenance & Monitoring > Cloud Assistant.

  2. In the top navigation bar, select the region and resource group to which the resource belongs. 地域

  3. 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

  1. Log on to the server by using SSH.

    For more information, see Connection method overview.

  2. Run the following command to deregister the managed instance:

    sudo aliyun-service --deregister
  3. Stop and uninstall the Cloud Assistant daemon process.

    1. Run the following command to stop the Cloud Assistant daemon process:

      sudo /usr/local/share/assist-daemon/assist_daemon --stop
      Note

      In the preceding command, /usr/local/share/assist-daemon/assist_daemon is the default path of the Cloud Assistant daemon process.

    2. Run the following command to uninstall the Cloud Assistant daemon process:

      sudo /usr/local/share/assist-daemon/assist_daemon --delete
  4. Run the following command to stop Cloud Assistant Agent.

    Note

    The 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
  5. 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
  6. Delete the Cloud Assistant daemon process and Cloud Assistant Agent.

    1. 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
    2. 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

Note

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.

  1. Log on to the server by using Remote Desktop Connection.

    For more information, see Connection method overview.

  2. Run Windows PowerShell.启动powershell

    1. Click Start.

    2. Choose Windows PowerShell > Windows PowerShell.

    3. Right-click Windows PowerShell and select Run as administrator.

  3. Run the following command in Windows PowerShell to deregister the managed instance:

    aliyun-service --deregister
  4. Open the service management window. 服务

    1. Click Start.

    2. Choose Windows Administrative Tools > Services.

  5. Find Aliyun Assist Service and click Stop the service.windows停止服务

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.