Cloud service interaction uses a custom rule to combine Anti-DDoS Proxy with Alibaba Cloud public IP resources. It removes the extra latency that normal service access incurs after your website is added to Anti-DDoS Proxy.
Applicable scope
Your service uses Alibaba Cloud public IP resources, specifically Elastic Compute Service (ECS) instances or Server Load Balancer (SLB) instances that have public IP addresses, elastic IP addresses (EIPs), and Web Application Firewall (WAF).
You have purchased Anti-DDoS Proxy (Chinese Mainland) - Profession or Anti-DDoS Proxy (Outside Chinese Mainland) - Insurance or Unlimited.
ImportantThe clean bandwidth, QPS, and other specifications of the Anti-DDoS Proxy instance must meet the protection requirements of your normal service. For more information, see Purchase an Anti-DDoS Proxy instance.
Your website service is added to an Anti-DDoS Proxy instance for protection. For more information, see Add a website configuration.
You have verified that the Anti-DDoS Proxy instance forwards service traffic correctly. For more information, see Locally validate your forwarding configuration.
Background information
After your service is added to Anti-DDoS Proxy, all service traffic is forwarded through Anti-DDoS Proxy by default. Attack traffic is discarded after traffic scrubbing, and only normal service traffic is forwarded to the origin server. During normal service access when no attack occurs, normal service traffic also passes through Anti-DDoS Proxy, which adds a small amount of latency to service access.
To avoid the extra latency during normal service access, create a cloud service interaction rule in Sec-Traffic Manager. Traffic then goes directly to the origin server without extra latency during normal access, and switches to Anti-DDoS Proxy only when your service is under attack. Anti-DDoS Proxy then scrubs traffic and forwards it to the origin server.
How a cloud service interaction rule works
The cloud service interaction solution uses DNS-based intelligent resolution to schedule traffic dynamically and adjusts the traffic path based on the security status of your cloud resources.
The cloud service interaction solution switches traffic by using DNS scheduling. When a cloud asset enters blackhole filtering, it becomes inaccessible.
Your service is affected during the switching process. The interruption duration depends on how long the client-side local DNS cache takes to refresh.
Normal state (no attack): Service traffic does not pass through Anti-DDoS Proxy for traffic scrubbing. Traffic goes directly from the client to the cloud resource.
Traffic path: client → cloud resource (direct access).
How it works: when the cloud resource is not under a DDoS attack, service traffic bypasses the Anti-DDoS Proxy scrubbing node. Traffic is resolved directly from the client to the cloud resource IP address, which ensures minimal latency and optimal performance.
Attack state (traffic scrubbing triggered): Traffic automatically switches to Anti-DDoS Proxy for traffic scrubbing, so that only normal service traffic is forwarded to the cloud resource.
NoteYou can also switch traffic to Anti-DDoS Proxy manually. For more information, see Traffic switching.
Trigger condition: the monitoring system detects that the cloud resource is under a DDoS attack and that all cloud resource IP addresses enter blackhole filtering.
Traffic path: client → Anti-DDoS Proxy (traffic scrubbing) → cloud resource.
How it works:
The system automatically updates the DNS record to point your domain name to the CNAME address of Anti-DDoS Proxy.
Service traffic is directed to the Anti-DDoS Proxy cluster for malicious traffic scrubbing.
Only normal service traffic is forwarded back to the cloud resource, which ensures service continuity.
Recovery state (automatic switchback)
Trigger condition: the DDoS attack ends and traffic stays stable for a period of time.
How it works:
After the attack stops, Anti-DDoS Proxy enters a switchback waiting period (the configurable Fallback Time) to check whether the attack rebounds.
When the waiting period ends, the system automatically restores the DNS record to the cloud resource IP address.
Service traffic connects directly to the cloud resource again and exits the Anti-DDoS Proxy scrubbing mode.
Configure a cloud service interaction rule
Log on to the Anti-DDoS Proxy console.
In the top navigation bar, select the region of your instance.
Anti-DDoS Proxy (Chinese Mainland): Choose the Chinese Mainland region.
Anti-DDoS Proxy (Outside Chinese Mainland): Choose the Outside Chinese Mainland region.
In the left-side navigation pane, choose .
For the Cloud Service Interaction scenario, on the General Interaction tab, click Create Rule.
In the Create Rule panel, on the Cloud Service Interaction tab, configure the following parameters and click Next.
Parameter
Description
Interaction Scenario
Select Cloud Service Interaction.
Rule Name
The rule name can contain letters, digits, and underscores (_) and cannot exceed 128 characters in length.
Anti-DDoS Pro or Anti-DDoS Premium Instance
Select the Anti-DDoS Proxy instance that you want to associate with the rule.
Resource for Interaction
Enter the IP Address of Cloud Resource that you want to associate with the rule. You can use an ECS instance IP address, an SLB instance IP address, a WAF instance IP address, or an EIP.
Click Add IP Address of Cloud Resource to add multiple cloud resources. You can add up to 20 IP addresses.
NoteIf you add multiple cloud resource IP addresses, they are associated with a single Anti-DDoS Proxy IP address. When a DDoS attack occurs on one cloud resource IP address, the other cloud resource IP addresses are used first. Traffic switches to Anti-DDoS Proxy for protection only when no cloud resource IP address is available.
If you want multiple cloud resources to share traffic and each resource to switch to Anti-DDoS Proxy independently when it is attacked, see Multi-path failover.
Fallback Time
The waiting time before the switchback process (switching traffic back to the cloud resource IP addresses) can be triggered after service traffic is switched to Anti-DDoS Proxy for protection. After the attack ends and this waiting time elapses, service traffic automatically switches back to the cloud resource IP addresses.
Valid values: 30 to 120 minutes. The recommended value is 60 minutes.
Update the DNS configuration: To ensure that the interaction rule in Sec-Traffic Manager takes effect, complete the DNS configuration changes as prompted on the page.
Local verification: (Strongly recommended) Before you update the public DNS records, modify the
hostsfile on your local computer to simulate the resolution change and verify the traffic rerouting rule. This helps you avoid incompatibility issues caused by inconsistent back-to-origin policies. The following are typical risk cases:NoteFor more information about how to verify a traffic rerouting rule, see Locally validate your forwarding configuration.
Scenario: CDN + Anti-DDoS Proxy + OSS interaction
Potential conflict:
CDN: supports customizing the Back-to-origin HOST so that the OSS bucket is correctly identified.
Anti-DDoS Proxy: does not support modifying the back-to-origin HOST and uses the Host header in the request by default.
Symptom: When an attack triggers an automatic switchover to Anti-DDoS Proxy, the Host header passed through by Anti-DDoS Proxy does not match what OSS expects. OSS cannot identify normal traffic, which causes service access failures.
Update the DNS record: After you complete the local verification and confirm that everything works as expected, perform the actual DNS change. Update the DNS record of your domain name to point to the CNAME address provided by Sec-Traffic Manager. Follow the instructions for your domain name registrar:
Domain name registrar
Instructions
Alibaba Cloud
Log on to the Alibaba Cloud DNS console and update the record.
Third-party platform
Log on to the management platform of the third-party registrar where your domain name is registered and update the DNS record of the domain name.
Verify the result: After you update the DNS record, use a browser to test whether your website is accessible.
NoteAfter you complete the update, the rule may take some time to fully take effect because of the global DNS propagation time (TTL). For more information, see Modify a CNAME record for Traffic Scheduler.
If your website does not work as expected, troubleshoot the issue first. For more information, see Troubleshoot slow response, high latency, and access failures for services protected by Anti-DDoS Proxy.
Traffic switching
To meet the flexibility requirements of different service scenarios, Cloud Service Interaction rules support two switching modes:
Both the automatic mode and the manual mode rely on updates to the underlying DNS scheduling mechanism during switching. The switching process may be affected by network convergence time. (Recommended) Evaluate the tolerance of your service in advance.
Switching mode | Description | Scenarios |
Automatic switchover | Based on real-time traffic monitoring and attack characteristics, the system automatically switches to or exits the Anti-DDoS Proxy mode. | Delivers unattended automated protection around the clock without manual intervention. |
Manual switchover | You can manually trigger a switchover or a switchback in the console based on service forecasts, drill requirements, or special security events. |
|
Automatic switchover
Switching type | Trigger condition |
Switch from a cloud asset to Anti-DDoS Proxy | All IP addresses of cloud resources enter blackhole filtering. |
Switch back from Anti-DDoS Proxy to a cloud asset | After the attack on the cloud asset ends, the system waits for a period of time (Fallback Time), and then automatically switches service traffic back to the cloud resource. |
Manual switchover
In addition to automatic switchover, you can manually switch service traffic to Anti-DDoS Proxy for traffic scrubbing or switch it back to the cloud resource based on your service protection requirements.
Operation | Description | Limits |
Switch to Anti-DDoS |
|
|
Switchback |
Note Before you perform a switchback, make sure that the attack has ended and that the line of the Resource for Interaction to switch back to is available. This prevents service interruptions caused by a Resource for Interaction in sandbox status. |
|
Other operations
After you add a General Interaction rule, you can perform the following operations on the added rules in the rule list.
Operation | Description |
Edit | Edit a General Interaction rule. You can modify the parameter settings other than Interaction Scenario and Rule Name. |
Delete | Delete a General Interaction rule. Warning Before you delete an interaction rule, make sure that the DNS record of your website domain name does not point to the Sec-Traffic Manager CNAME. Otherwise, your website becomes inaccessible after the interaction rule is deleted. |
icon appears).