In an Elastic Compute Service (ECS) cluster, you can associate a Server Load Balancer (SLB) instance with the instances of an application. This way, traffic destined for the IP address of the SLB instance can be forwarded to the instances of the application.
Prerequisites
An SLB instance is created. For more information, see Create a CLB instance.
Background information
You can associate an SLB instance with the instances of a single application in the Enterprise Distributed Application Service (EDAS) console. This way, the SLB instance is exclusively used by the application. The following figure shows an EDAS cluster in which two applications named App1 and App2 are deployed. App1 is deployed on three instances, and App2 is deployed on two instances. You can associate an SLB instance with the instances of each application. When you associate an SLB instance with the ECS instances of an application in the EDAS console, EDAS creates a vServer group for the application and adds the ECS instances of the application to the vServer group. The resources and bandwidth of each SLB instance are exclusive to an application. The queries per second (QPS) performance of an application depends on the specifications of the SLB instance.
If you have an application that is deployed on multiple ECS instances, and want to configure a public IP address for the application to allow access from other applications, you can associate an SLB instance with the instances of the application. This ensures the security of the instances.
In this example, an Internet-facing Application Load Balancer (ALB) instance is used. If you need to associate an Internal-facing SLB instance with the instances of the application, you must specify the internal network when you verify the associating result.
Procedure
- Log on to the EDAS console. In the left-side navigation pane, choose .
- On the Applications page, select a region in the top navigation bar and an option from the Microservice Namespace drop-down list. Select ECS Clusters from the Cluster Type drop-down list. Then, click the name of the required application in the application list.
- In the Application Settings section of the Basic Information page, click Add next to SLB (Internet). Note If you have configured an SLB instance, the IP address and port number of the SLB instance are displayed. You can click Modify to go to the configuration page and modify the settings of the SLB instance. You can also click Unbind to unbind the SLB instance.
In the AddLoad Balancing (Public) wizard, configure the SLB instance.
In the Select SLB Instance step, set the SLBType parameter to ALB or CLB. Select the SLB instance that you have created from the SLB (Internet) drop-down list and click Next.
In the Select and Configure Listener step, configure a listening port, and then click Next.
If you set the SLBType parameter to ALB, you can select only an existing port. If you set the SLBType parameter to CLB, the following two options are available:
If you want to use an existing listening port that has been configured for the specified SLB instance, select Select Existing Listening Port and then select the listening port.
If no listening port is configured for the specified SLB instance or you want to add a listening port for the application, select Add Listening Port and then create a listener.
Parameters
Parameter
Description
Protocol
A listener that defines how to forward inbound requests to backend servers. After you associate SLB instances with the instances of the applications that are hosted on ECS clusters in EDAS, you must configure listeners for the SLB instances. TCP and HTTP are supported for applications that are hosted on ECS clusters. Select a protocol as needed. For more information about listeners and how to create a listener, see Listener overview and Create a listener.
NoteTCP is applicable to scenarios that require high reliability and data accuracy but medium data transfer speed. For example, you can use TCP to transfer files, send or receive emails, and perform remote logons.
HTTP is applicable to applications that need to identify data content, such as web applications and small mobile games.
Frontend Port Number
The number of the port that is used by the SLB instance to provide external services.
Health Check Path (URI)
The URI that is used by the SLB instance to check the status of the backend. Default value: /_ehc.html. Enter a valid URI. For more information, see Configure and manage health checks. The Health Check Path (URI) parameter is displayed only if the Protocol parameter is set to HTTP.
Backend Port Number
The port number of the application. The value is fixed.
In the Configure vServer Group and Forwarding Policy step, configure a vServer group for the SLB instance, and then click Next.
NoteIf you associate a dedicated SLB instance with the instances of an application, you do not need to configure a forwarding policy.
If you set the SLBType parameter to ALB, you can select only an existing vServer group. If you set the SLBType parameter to CLB, the following three options are available:
If you configure a dedicated SLB instance for the application, we recommend that you use the default vServer group.
NoteThe default vServer group does not support forwarding policies.
If you want to use an existing vServer group that has been created for the specified SLB instance, select Existing VServer Group and select the vServer group.
ImportantA vServer group can be associated with the instances of only one application or application group.
If no vServer group is configured for the specified SLB instance or you want to configure a new vServer group, select Create VServer Group and specify the VServer Group Name parameter.
In the Confirm step, check the SLB instance settings, and click Confirm.
Verification
Go to the Basic Information tab. In the Application Settings section, copy the IP:Port of the SLB instance next to
SLB (Internet)
For example, the copied value is115.28.XX.XX:80
.If
IP:Port
does not appear next to SLB (Internet), the SLB instance fails to be associated. Check the change records to identify the error cause and fix the error. For more information, see View application changes.Paste the
IP:Port
in the browser and check whether you can access the application.