You can bind a Server Load Balancer (SLB) instance to multiple applications to save
costs. These applications share a public IP address and port. You can configure forwarding
policies to forward requests to the applications. This topic describes how to configure
domain names to distribute traffic for multiple applications that are bound to the
same SLB instance and share the same port.
Background information
Note You can configure only HTTP listeners to distribute traffic in Elastic Compute Service
(ECS) clusters.
For example, you have two applications. One is the User application that is used to
query orders. The other is the Order application that is used for user logon. Both
applications use the same public IP address and port. By default, port 80 is used.
You can configure different domain names to distribute traffic for the applications.
In this example, u.domain.com is configured for the User application and o.domain.com is configured for the Order application.
Bind the SLB instance to the first application and configure a domain name-based forwarding
policy
Bind the SLB instance to the first application, and configure a listening port, vServer
group, and domain name-based forwarding policy.
- Log on to the EDAS console.
- In the left-side navigation pane, click Applications.
- 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.
- Configure the SLB instance in the Bind SLB Instance to Application wizard.
- In the Select SLB step, select the SLB instance that you have created from the SLB (Internet) drop-down list, and then click Next.
- In the Select and Configure Listener step, configure a listening port, and then click Next.
- If you want to use a listening port that is configured for the specified SLB instance,
select Select Existing Listening Port and select an existing listening port.
- If no listening port is configured for the specified SLB instance or you want to add
a listening port to the application, select Add Listening Port and then create a listener.
Parameters
Parameter |
Description |
Protocol |
TCP and HTTP are supported. Select a protocol as needed. For more information, see
Listener overview.
|
Frontend Port Number |
The number of the port that is used by the SLB instance to provide services.
Notice If the port number that you want to add is used by another listening protocol, you
must set another port number. You can also log on to the SLB console to remove the listening port, and then add the port in the EDAS console.
|
Health Check Path (URI) |
The URI that is used by the SLB instance to check the status of the backend. The default
value is /_ehc.html. Enter a valid URI. For more information, see Configure health check.
|
Backend Port Number |
The port number of the application. The value is fixed. |
- In the Configure VServer Groups and Forwarding Policies step, configure a vServer group for the SLB instance, configure a domain name-based
forwarding policy, and then click Next.
Note The default server group does not support forwarding policies. Therefore, you cannot
select the default server group if you use a domain name to distribute traffic. You
must select a vServer group.
You can use one of the following methods to configure a vServer group and domain name-based
forwarding policy for an application:
- If you want to use the vServer group that is created for the specified SLB instance,
perform the following operations:
- Select Existing VServer Group and then select an existing vServer group.
Notice A vServer group can be bound to only one application or application group.
- Configure a forwarding policy.
- To use a forwarding policy that is configured for the vServer group, select Modify the forwarding policy of the current VServer group and then select the required forwarding policy.
- If no forwarding policies have been configured for the vServer group or you want to
add a forwarding policy, select Add Forwarding Policy and then specify a domain name in the Forwarding Policy field.
- If no vServer group has been configured for the specified SLB instance or you want
to add a vServer group for the application, perform the following operations:
- Select Create VServer Group and set the VServer Group Name parameter.
- Select Add Forwarding Policy and then specify a domain name in the Forwarding Policy field.
- In the Confirm SLB Change step, check the settings of the SLB instance and click Confirm.
- Check whether you can access the application by using the configured domain name-based
forwarding policy. For more information, see Verify results.
Bind the SLB instance to the second application and configure a domain name-based
forwarding policy
Bind the SLB instance to the second application. When you configure the SLB instance,
use the port number that is specified for the first application. Configure a vServer
group and a domain name-based forwarding policy that are not used by the first application.
- Log on to the EDAS console.
- In the left-side navigation pane, click Applications.
- 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.
- Configure the SLB instance in the Bind SLB Instance to Application wizard.
- In the Select SLB step, select the SLB instance that you have created from the SLB (Internet) drop-down list, and then click Next.
- In the Select and Configure Listener step, select Select Existing Listening Port, select the same listening port as the first application, and then click Next.
- In the Configure VServer Groups and Forwarding Policies step, configure a vServer group for the SLB instance, configure a domain name-based
forwarding policy, and then click Next.
Note The default server group does not support forwarding policies. Therefore, you cannot
select the default server group if you use a domain name to distribute traffic. You
must select a vServer group.
A vServer group can be bound to only one application or application group. Therefore,
the specified vServer group cannot be the same as the vServer group that is bound
to the first application. We recommend that you select Create vServer Group and Add Forwarding Policy.
If you have created an SLB instance and configured a vServer group and forwarding
policy in the SLB console, you can use the existing vServer group and forwarding policy.
For more information, see 5.

- In the Confirm SLB Change step, check the settings of the SLB instance and click Confirm.
- Check whether you can access the application by using the configured domain name-based
forwarding policy. For more information, see Verify results.