Mounting ALB to Cross-region VPC Cloud Server
The Application Load Balancer (ALB) supports the function of cross-regional mounting. This article guides you on how to use ALB in conjunction with the UCloud Network (UGN) to forward ALB requests to servers in other regions.
Prerequisites
- You have created a private network VPC1 in the North China Region 2, and a private network VPC2 in Shanghai Region 2.
- You have created an ALB instance in VPC1.
- You have created a Uhost instance in VPC2 and deployed the business.
Configuration Process
1. Create a UGN Instance
-
Log in to the UGN console.
-
Click to create a UGN Instance.
-
Input the UGN instance name, and add VPC1 and VPC2 that have been created to the current instance.
-
Enter the created UGN instance page, select the Bandwidth Package tab;
-
Purchase a bandwidth package from North China Region 2 to Shanghai Region 2.
2. Add Listener
-
In the top navigation bar, choose the region where to create the ALB instance.
-
Choose one of the following ways to open the listening configuration.
-
On the Instance List page, click Listener Management in the Operations column of the target instance.
-
On the Instance List page, click the target instance ID or details. On the Listener Management tab, click Add Listener.
-
-
On the Create Listener page, complete the following configurations and then click Confirm. | Configuration Item | Description | | ------------ | ------------------------------------------------------------ | | Protocol | Choose the protocol type for listening, this example chooses HTTP | | Port | Input the listening port that is used to receive requests and forward requests to the back-end server, the port range is 1~65535. A listening port cannot be repeated within the same ALB instance. This example chooses port 80 | | Load Balancing Algorithm | Choose a scheduling algorithm for load balancing, this example chooses the round-robin algorithm which distributes user requests to backend servers in turns | | Service Session Persistence | Choose whether to enable or disable session persistence. By default, ALB will distribute each client’s request to a different backend server. Once you open the session persistence function, session persistence can forward requests from the same client to the same backend server, facilitating backend server maintenance of status information and providing continuous experience to the client | | Connection Idle Timeout | Specify the connection idle timeout period. The default range is 60 seconds. If it hasn’t been accessed in the timeout period, ALB will temporarily interrupt the current connection until a new request comes in and establishes a new connection | | Node Health Check | Choose the mode for node health check; Port check: Use the backend server’s port for health check. HTTP check: Send a HEAD request to simulate browser access behavior to check if the server application is healthy | | Data Compression | Enabling this configuration will compress gzip file types | | Redirection | If enabled, requests accessing the current listener will be strictly redirected to access requests of the destination listener | | Listener Name | Input the listener name | | Remarks | Input the listener’s remark information |
3. Add Service Node
-
Enter the Listener Management tab, click to add node.
-
Complete the following configurations.
Configuration Item | Description |
---|---|
Resource Type | Choose the Intranet IP resource type |
Region | Choose the North China Region 2 |
Belonging VPC | Choose VPC2 created in North China Region 2 |
Listening Port | 80 |
Resource | Input the Intranet IP of the created Uhost instance |
4. Test Connectivity
- Visit the public IP address of ALB;
- Check to see if you can access the business deployed in the Uhost of North China Region 2;
Notes
- The backend server of the ALB cross-regional mounting only supports IP type.
- VPC1 and VPC2 should be added to the same UGN.
- Scenarios where forwarding paths have loops are not supported. If a loop is detected, to avoid exhausting network resources, ALB will migrate the instance and no longer guarantee the availability of the loop instance.