After the ECS instances are replicated, you can create a multi-zone SLB instance in a region that supports multiple zones and bind multi-zone ECS instances to the SLB instance. This task can extend the external service capabilities of application systems, eliminate single point of failures, and improve the availability of application systems. This topic describes how to deploy an SLB instance.

Prerequisites

  • Three ECS instances are replicated. For more information, see Replicate ECS instances.
  • The web services of the four ECS instances are started and are running normally.
    Notice If the web services are not running, the SLB instance and the ECS instances cannot communicate normally.

Procedure

  1. Create an SLB instance. For more information, see Create an SLB instance.
    The following settings are used in this topic:
    • Region: Select the same region as the ECS instances.
    • Zone Type: Select Multi-zone.
    • Instance Type: Select Internal Network.
    • Network Type: Select VPC.
    • Primary Zone and Backup Zone: Configure as needed.
  2. Convert the public IP address of the source instance into an Elastic IP Address. For more information, see Convert an ECS public IP address in a VPC to an Elastic IP Address.
    Note The IP address of the source instance must remain unchanged so that services are not affected. Therefore, you must first convert the public IP address of the source instance into an Elastic IP Address, unbind the Elastic IP Address from the source instance, and then bind the Elastic IP Address to the multi-zone SLB instance.
    ip_eip
  3. Unbind the Elastic IP Address from the source instance.
    1. In the IP Address column of the source instance, click the link of the Elastic IP Address.
    2. On the Elastic IP Addresses page, click Unbind.
      unbindEIP
    3. Click OK. For more information, see Unbind an Elastic IP address from a cloud instance.
  4. Bind the Elastic IP Address to the SLB instance.
    1. On the Elastic IP Addresses page, find the Elastic IP Address that was unbound from the source instance.
      bindEIP
    2. In the Actions column, click Bind.
    3. Select SLB Instance for Instance Type, select the SLB instance that you created for SLB Instance, and then click OK. For more information, see Bind an ElP to an SLB instance.
  5. Configure an SLB instance. For more information, see Configure an SLB instance.
    Perform the following steps to complete the basic settings:
    1. On the Protocol and Listener tab, complete the following configuration:
      • Select Listener Protocol: Select TCP.
      • Listening Port: Enter 80.
      • Scheduling Algorithm: Set this parameter as needed. In this topic, Scheduling Algorithm is set to Round-Robin (RR).
      • Use the default values for other settings.
      configure_slb
    2. Click Next. On the Backend Servers tab, select Default Server Group, and click Add More to add the ECS instance.
      addEcsInstance
    3. Select the source instance and the three replicated ECS instances, and click Next: Set Weight and Port. Set Port to 80 and remain the default values for other settings. Click Next.
    4. On the Health Check tab, use the default values and then click Next.
    5. On the Submit tab, verify the information and click Submit.
    6. Click OK to go back to the Server Load Balancer page, and click refresh.
      If the health check is Normal, the backend ECS instance is working properly and able to accept requests.
      Note It takes a few minutes to perform the health check. Wait and click the refresh icon to view the status.
      health_check

Result

In this topic, a static web page is built on each of the four ECS instances to identify each instance. Enter the endpoint of the SLB instance in the browser to test whether the SLB is working properly. Because Scheduling Algorithm was set to Round-Robin (RR), requests are sent to each ECS instance in turn.

What to do next

Migrate user-created databases to RDS instances