ALB Extensible Edition lets you combine a Forward to action with multi-level Fallback actions in a forwarding rule. If the primary target returns a 4xx or 5xx response, ALB tries each fallback in order until one succeeds, enabling high-availability architectures for large language model services.
Solution architecture
To ensure high availability and prevent downtime from a single model provider outage, you can configure an ALB Extensible Edition forwarding rule that routes requests to a primary service such as DeepSeek, with fallback actions that sequentially try OpenAI and Model Studio (Bailian) if the primary service fails. When a request matches this rule, ALB sends it to DeepSeek first. If the request fails (4xx or 5xx error), ALB automatically forwards it to OpenAI, then to Model Studio (Bailian), until a successful response is received. The fallback feature can also automatically rewrite the model name in the request body to match the model expected by each target service.
-
ALB Extensible Edition instance: Handles load balancing and traffic forwarding.
-
AI server group: Connects to backend large model services. This example uses three server groups: DeepSeek, OpenAI, and Model Studio (Bailian).
-
HTTPS listener: Receives client requests.
-
Forwarding rule : Matches requests based on AI model conditions and configures
Forward toandFallbackactions.
Prerequisites
-
You have been granted access to the ALB Extensible Edition public beta.
-
You have created a Virtual Private Cloud (VPC) in the China (Ulanqab) region, with one vSwitch in availability zone A and another in availability zone B. The vSwitches must have public-facing SNAT configured so that the AI server groups can call public large model services.
-
You have activated Model Studio (Bailian), obtained an API key, and added the API key as an identity credential in Identity Management. To demonstrate fallback, you have also created two additional identity credentials that contain incorrect API keys (for example,
fake-api-key) for the DeepSeek and OpenAI server groups to reference. -
You have registered a custom domain. Because this guide deploys the ALB instance in the China (Ulanqab) region, the domain requires an ICP filing.
-
You have a server certificate that matches your custom domain. If you did not purchase the certificate from Alibaba Cloud, you must upload it to Alibaba Cloud Certificate Service.
Procedure
1. Create an ALB Extensible Edition instance
-
Log on to the ALB console, select the China (Ulanqab) region, and then click Create ALB.
-
On the purchase page, complete the following configurations and click Create Now.
-
Region: Select China (Ulanqab).
-
Instance network type: Select Internet.
-
VPC and Availability zone: Select the target VPC. Then, select the checkboxes for Ulanqab Zone A and Ulanqab Zone B, select the corresponding vSwitch for each, and select Assign EIP.
-
IP version: Select IPv4.
-
Edition (instance fee): Select Extensible Edition.
-
-
On the Confirm Order page, review the instance configuration details and click Activate Now.
2. Create AI server groups
Create three AI service-type server groups for DeepSeek, OpenAI, and Model Studio (Bailian). To demonstrate fallback, the DeepSeek and OpenAI server groups reference identity credentials that contain incorrect API keys so that requests to them fail and trigger the fallback mechanism.
Create the DeepSeek server group
-
In the Server group console, click Create Server Group. For Server Group Type, select AI Service, and enter the name
sgp-fake-deepseek. -
Click Create. In the The server group is created dialog box, click Add Backend Server.
-
In the Add AI Service dialog box, complete the following configurations and click OK.
-
Model provider: Select DeepSeek.
-
Endpoint: Automatically populated after you select the Model provider.
-
Identity Credential: Select the identity credential that contains an incorrect API key.
-
Create the OpenAI server group
-
Repeat the steps above to create a second AI Service-type server group named
sgp-fake-openai. -
When you Add Backend Server, select Model provider as OpenAI, set Identity Credential to the identity credential that contains an incorrect API key, and then click OK.
Create the Model Studio (Bailian) server group
-
Repeat the steps above to create a third AI Service-type server group named
sgp-bailian. -
When you Add Backend Server, select Model provider as the Alibaba Cloud Model Studio, set Identity Credential to the identity credential that contains a valid API key, and then click OK.
3. Create a listener
-
In the ALB console, click the ID of your target instance to go to the Instance Details page. On the Listener tab, click Create Listener.
-
In the Configure Listener step, set Listener Protocol to HTTPS and Listener Port to
443. Then, click Next. -
In the Configure SSL Certificate step, select the server certificate that matches your custom domain and click Next.
-
In the Select Server Group step, select the AI Service type and the server group
sgp-fake-deepseek. Then, click Next.The server group selected here is used for the listener's default rule, which processes requests that do not match any other forwarding rules. You can adjust this based on your needs.
-
In the Configuration Review step, confirm the configuration and click Submit.
4. Configure a forwarding rule
ALB evaluates forwarding rules in ascending order of priority. Once a request matches a rule, ALB executes that rule's action and skips the remaining rules.
-
On the Listener tab of the instance details page, click the ID of your target listener. On the Listener Details page, switch to the Forwarding Rules tab.
-
Click Add New Rule, complete the following configurations, and then click OK.
-
Add Condition: Select AI Model and enter
deepseek-chatfor Model Name. -
Action: Forward To the server group
sgp-fake-deepseek. -
Add Action: Configure a Fallback to the server group
sgp-fake-openaiand entergpt-3.5for the Model Name on the right. -
Under the Fallback section, click Add Server Group. Select the server group
sgp-bailianand enterqwen-turbofor the Model Name on the right.
-
The AI Model condition matches all requests that use an OpenAI-compatible protocol, have a request path of/v1/completions,/v1/chat/completions, or/v1/embeddings. If you specify a Model Name, themodelfield in the request body must also match the specified name.
When you configure a model name for a fallback action, ALB automatically rewrites the model field in the request body to the specified name during fallback. This ensures the request body matches the model expected by the target service.
5. Set up DNS resolution
Create a CNAME record that points your custom domain to the DNS name of the ALB instance, so that clients can access ALB through your domain.
This guide uses Alibaba Cloud DNS as an example. If your domain is not registered with Alibaba Cloud, add the domain to the Alibaba Cloud DNS console first.
-
In the ALB console, copy the Domain Name of your target instance.
-
Log on to the Alibaba Cloud DNS console. In the Actions column for your target domain, click Settings. On the Settings page, click Add Record.
-
Add a CNAME record with the following information and click OK.
-
Record Type: Select CNAME.
-
Hostname: Enter a domain prefix, such as
ai. If your root domain isexample.com, the full domain for accessing ALB will beai.example.com. -
Query Source and TTL: Keep the default settings.
-
Record Value: Enter the DNS name of the ALB instance.
-
-
In the Change Resource Record Confirmation dialog box, review the DNS information and click OK.
6. Test and verify
-
Use the curl command to verify that the request falls back to the correct large model service. Replace
ai.example.comwith your configured domain. Make sure the DNS record has propagated. -
The client request must use the OpenAI-compatible protocol. The request path must be
/v1/completions,/v1/chat/completions, or/v1/embeddings, and the request body must include themodelfield. ALB uses themodelvalue for routing.
curl -v \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-chat",
"messages": [
{
"role": "user",
"content": "Who are you"
}
]
}' \
https://ai.example.com/v1/chat/completions
A successful request returns the following response. Because sgp-fake-deepseek and sgp-fake-openai use incorrect API keys, ALB receives failed responses and falls back sequentially, ultimately forwarding the request to sgp-bailian. The response shows model as qwen-turbo and content containing an introduction from Qwen, confirming that the request fell back to Model Studio (Bailian) and the model name was rewritten to qwen-turbo.
{
"choices": [
{
"message": {
"role": "assistant",
"content": "I am Qwen, a large language model from Alibaba's Tongyi Lab. I can answer questions, create text, use logical reasoning, and write code. How can I help you?"
},
"finish_reason": "stop",
"index": 0
}
],
"object": "chat.completion",
"model": "qwen-turbo"
}
More information
Billing
-
ALB Extensible Edition: This feature is currently in public beta and is free to use.
-
Internet access fees: NAT Gateway charges instance fees and capacity unit (CU) fees. The Elastic IP Addresses (EIPs) bound to the NAT Gateway and ALB Extensible Edition instance have separate billing rules, charged by the EIP service.
-
Domain and DNS fees: In addition to domain registration fees, configuring DNS resolution with Alibaba Cloud incurs public authoritative DNS fees.
-
Certificate fees: Purchasing a certificate from Alibaba Cloud or uploading a third-party certificate incurs server certificate fees.
-
Model Studio fees: Calling the Model Studio large model API incurs usage fees.
Limitations
-
Fallback is supported for the following server group types: Server, IP Address, Function Compute, FQDN, and AI Service. These server group types can be used as targets for both Forward To and Fallback actions.
-
If you configure a fallback to a non-AI Service server group, ensure that the server group provides an OpenAI protocol-compatible model service.
-
By default, you can configure up to five fallback services for a single forwarding rule. To increase this quota, submit a ticket.
-
The trigger conditions for fallback (HTTP 4xx or 5xx status codes) are fixed and cannot be customized.
ALB Extensible Edition regions
|
Area |
Region |
Zone |
|
China |
China (Ulanqab) |
Zone A, Zone B, and Zone C |
|
China (Hangzhou) |
Zone J and Zone K |
|
|
China (Beijing) |
Zone I, Zone K, and Zone L |
|
|
China (Shanghai) |
Zone B and Zone F |
|
|
China (Hong Kong) |
Zone B, Zone C, and Zone D |
|
|
Asia-Pacific |
Singapore |
Zone A, Zone B, and Zone C |
|
Japan (Tokyo) |
Zone B, Zone C, and Zone E |
|
|
Malaysia (Kuala Lumpur) |
Zone A, Zone B, and Zone C |
|
|
Europe and Americas |
Germany (Frankfurt) |
Zone A and Zone B |
|
US (Silicon Valley) |
Zone A and Zone B |
|
|
Middle East |
UAE (Dubai) |
Zone A and Zone B |
Recommendations
-
Plan the fallback order : ALB executes fallback actions in the order they are configured. Plan the priority of each fallback service based on model availability, cost, and response latency.
-
Ensure model consistency: Output formats and capabilities vary between model providers. Select models with similar capabilities for each fallback service to minimize the impact on your business logic during fallback.
FAQ
I configured fallback, but it is not being triggered. Why?
-
Verify that the forwarding rule's conditions match the request and that the rule has the highest priority among all matching rules.
-
Confirm that the server group in the Forward To action is returning a 4xx or 5xx status code.
The model returns an error after a fallback. Why?
-
Check if the API key for the fallback target server group is correct.
-
If you configured model name rewriting, verify that the rewritten model name matches a model supported by the target service.