Routing Traffic to Backend Servers in the Same VPC as the Load Balancer
You can route traffic to backend servers in the VPC where the load balancer is running.
Solution Design​
- A dedicated load balancer
ELB-Test
is running in a VPC namedvpc-Test
(10.1.0.0/16
). - The backend server
ECS-Test
is also running invpc-Test
(10.1.0.0/16
). ECS-Test
needs to be added to the backend server group associated withELB-Test
.
You can add servers in the same VPC as the load balancer to the backend server group of the load balancer and then route incoming traffic to the servers.
Prerequisites​
To calculate the fees you can visit Open Telekom Cloud Price calculator.
Resource Type | Resource Name | Description | Quantity |
---|---|---|---|
VPC | vpc-Test | The VPC where ELB-Test and ECS-Test are running: 10.1.0.0/16 | 1 |
ELB | ELB-Test | The dedicated load balancer named ELB-Test | 1 |
EIP | EIP-Test | The EIP bound to ELB-Test | 1 |
ECS | ECS-Test | The ECS works in vpc-Test | 1 |
Table 1 Resource planning
Procedure​
Creating a VPC​
-
Log in to the management console.
-
Under Networking, select Virtual Private Cloud. On the Virtual Private Cloud page displayed, click Create VPC.
-
Configure the parameters as follows and click Create Now. For details on how to create a VPC, see the Virtual Private Cloud User Guide.
- Name:
vpc-Test
- IPv4 CIDR Block:
10.1.0.0/16
- Configure other parameters as required.
- Name:
Creating an ECS​
-
Under Computing, click Elastic Cloud Server.
-
In the upper right corner, click Create ECS.
-
Configure the parameters as required. For details, see Elastic Cloud Server User Guide.
Select vpc-Test for VPC and set Name to
ECS-Test
. -
Deploy Nginx on the ECS.
Creating a Dedicated Load Balancer and Adding an HTTP Listener and a Backend Server Group to the Load Balancer​
-
Under Networking, click Elastic Load Balance.
-
In the upper right corner, click Create Elastic Load Balancer.
-
Configure the parameters as follows. For details, see Elastic Load Balance User Guide.
- Type:
Dedicated
- IP as a Backend:
Enable
- VPC:
vpc-Test
- Name:
ELB-Test
- Configure other parameters as required.
- Type:
-
Add an HTTP listener and a backend server group to the created dedicated load balancer. For details, see Elastic Load Balance User Guide.
Adding the ECS to the Backend Server Group​
-
Locate the dedicated load balancer and click its name ELB-Test.
-
On the Listeners tab page, locate the HTTP listener added to the dedicated load balancer and click its name.
-
In the Backend Server Groups tab on the right, click Add Backend Server, configure the parameters, and click OK. For details, see Elastic Load Balance User Guide.
- Backend Server:
ECS-Test
- Backend Port: the port enabled for Nginx on
ECS-Test
- Weight: Configure this parameter as required.
- Backend Server:
Verifying Traffic Routing​
EIP is not necessary as long as you don't want to access the ELB externally, you can always access the ELB from its private IP.
-
Locate the dedicated load balancer ELB-Test and click More in the Operation column.
-
Select Bind IPv4 EIP to bind an EIP to
ELB-Test
. -
Enter
http://<EIP>
in the address box of your browser to access the dedicated load balancer. If the following page is displayed, the load balancer routes the request toECS-Test
, which processes the request and returns the requested page.noteIn case of unhealthy connection of the backend server group, check if the ECS subnet and ELB subnet are associated with the above created route tables.