By using a cross-region endpoint in PrivateLink, a consumer VPC can establish an internal-facing connection across regions to the model inference service PAI-EAS. Data is transmitted entirely over the Alibaba Cloud private network and does not traverse the public network.
Scenario
A company deploys its PAI-EAS inference service in China (Shanghai) and exposes it through an ALB dedicated gateway. The development team in China (Hangzhou) needs to call the inference service across regions without sending data over the public network.
The company can create a private network path from Hangzhou to Shanghai by using a cross-region endpoint in PrivateLink, together with Private Zone for domain-level private routing. The complete path is:
Hangzhou VPC client → Private Zone → cross-region endpoint → PrivateLink connection → Shanghai endpoint service → ALB dedicated gateway → PAI-EAS inference service
Prerequisites
This topic uses a same-account connection between China (Shanghai), the service provider region, and China (Hangzhou), the client region. Replace the regions as needed for your business.
An ALB-type PAI-EAS dedicated gateway is deployed in China (Shanghai), and the inference service is attached to the gateway. For more information, see Use a dedicated gateway.
A VPC and a vSwitch have been created in China (Hangzhou). For more information, see VPCs and vSwitches.
Make sure that PrivateLink is enabled.
Procedure
Step 1: Create an endpoint service in China (Shanghai)
Create an endpoint service for the PAI-EAS dedicated gateway so that it can be accessed through PrivateLink from other regions.
For a cross-account connection to the endpoint service, add the service consumer account to the whitelist of the endpoint service.
Go to the PrivateLink - Endpoint Services page in the VPC console and switch the region to China (Shanghai).
Click Create Endpoint Service, configure the following parameters, click OK, and wait until the service status becomes Running.
Service Resource Type: Select ALB.
Select Service Resource: Select the ALB instance associated with the PAI-EAS dedicated gateway. We recommend that the zones of the service resource cover the zones of the ALB instance.
Supported Regions: Add China (Hangzhou) so that the region can create an endpoint connection to the endpoint service.
Automatically Accept Endpoint Connections: Select Yes. Endpoint connection requests are automatically approved, so you do not need to manually click Allow on the endpoint connection details page.
If you select No, the service provider must go to the details page of the endpoint service created in step 1. On the Endpoint Connections tab, find the target endpoint, and in the Actions column, click Allow to accept the endpoint connection from the service consumer.
Step 2: Create a cross-region endpoint in China (Hangzhou)
Create an endpoint in the consumer VPC and use a cross-region endpoint to access the endpoint service in China (Shanghai).
Switch the region to China (Hangzhou). Go to the PrivateLink - Endpoints page and click Create Endpoint.
Configure the following parameters and click OK.
Endpoint Type: Select Interface Endpoint.
Type: Select Select Service.
Enable inter-region endpoint: Select this option and choose China (Shanghai) as the service region. The system displays the endpoint services of this account in the selected region in the Available Services list.
Available Services: Select the endpoint service created in step 1.
VPC: Select the VPC in China (Hangzhou) and make sure that the selected vSwitch has available IP addresses.
Step 3: Configure private DNS resolution
Resolve the CNAME record of the private domain name for the EAS dedicated gateway to the Hangzhou endpoint domain name so that requests in the Hangzhou VPC are automatically routed through PrivateLink.
Obtain the private domain name of the EAS dedicated gateway: Log on to the PAI console. Select Elastic Algorithm Service (EAS), click the Inference Gateway tab, click the name of the target dedicated gateway, and obtain the domain name from the VPC tab. The domain name has the following format:
gw-xxxxxxxx-vpc.cn-shanghai.pai-eas.aliyuncs.com.Obtain the endpoint domain name: Obtain the domain name from the endpoint details page in China (Hangzhou). The domain name has the following format:
ep-xxx.epsrv-xxx.cn-hangzhou.privatelink.aliyuncs.com.Add a private authoritative domain name: Log on to the DNS console. On the Private Zone page, click Add Zone:
Authoritative Zone: Enter the domain name of the EAS dedicated gateway, such as
gw-xxxxxxxx-vpc.cn-shanghai.pai-eas.aliyuncs.com.Effective Scope: Select Effective in VPCs and select the VPC in China (Hangzhou) that needs to access the inference service.
Add a CNAME record: Go to the DNS records page for the domain name and click Add Record:
Record Type: Select CNAME.
Hostname: Enter @.
Record Value: Enter the endpoint domain name in China (Hangzhou) obtained in step 2.
After you configure CNAME resolution, when a client in the China (Hangzhou) VPC accesses the private domain name of the EAS dedicated gateway, DNS resolves the domain name to the endpoint domain name based on the CNAME record. Request traffic is forwarded through the PrivateLink connection to the dedicated gateway in China (Shanghai) and finally reaches the PAI-EAS inference service.
Step 4: Verify connectivity
On an ECS instance in the Hangzhou VPC, call the inference service by using the PAI-EAS VPC endpoint:
You must use-H "Authorization: <your-token>"to configure the token credential for authorization. Replace<your-token>with the service token for the PAI-EAS instance, which you can obtain from . Replace<gateway-domain>with the private domain name of the EAS dedicated gateway, replace<service-path>with the access path of the inference service, and replace<your-request-body>with the request body that contains the actual input for the inference service.
curl -v -X POST https://<gateway-domain>/<service-path> \
-H "Authorization: <your-token>" \
-d '<your-request-body>'Receiving a response from the target service indicates that the Hangzhou VPC has successfully accessed the EAS inference service in Shanghai across regions through PrivateLink. The call example is for reference only. The request method, request body, and response content are subject to the actual service. For more information, see Invoke the service.
More information
Billing: For billing information about PrivateLink, PAI-EAS, and Private Zone, see PrivateLink billing, PAI-EAS billing, and Private Zone billing.
Related products: For more information about the model online service PAI-EAS and Private Zone, see PAI-EAS and Private Zone.