Updated on 2024-12-26 GMT+08:00

Accessing a Real-Time Service Through a VPC Channel

Context

To access a ModelArts real-time service from an internal VPC node of your account, you can use a VPC channel. By creating an endpoint in your VPC and connecting to the ModelArts VPC endpoint service, you can access the real-time service from your VPC endpoint.

Constraints

When you call an API to access a real-time service, the size of the prediction request body and the prediction time are subject to the following limitations:
  • The size of a request body cannot exceed 12 MB. Otherwise, the request will fail.
  • Due to the limitation of API Gateway, the prediction duration of each request does not exceed 40 seconds.

Procedure

To access a real-time service through a VPC channel, follow these steps:

  1. Obtain the ModelArts VPC endpoint service address.
  2. Buy and connect to a ModelArts endpoint.
  3. Create a private DNS zone.
  4. Access a real-time service through VPC.
  1. Submit a service ticket and provide the account ID to Huawei Cloud technical support to obtain the ModelArts VPC endpoint service address.
  2. Buy and connect to a ModelArts endpoint.

    1. Log in to the VPC management console. In the navigation pane, choose VPC Endpoint > VPC Endpoints.
    2. Click Buy VPC Endpoint in the upper right corner.
      • Region: region where the VPC endpoint is located.

        Resources in different regions cannot communicate with each other. The region must be the same as that of ModelArts.

      • Service Category: Select Find a service by name.
      • VPC Endpoint Service Name: Enter the endpoint service address obtained in step 1. Click Verify on the right. The system automatically sets VPC, Subnet, and Private IP Address.
      • Create a Private Domain Name: Retain the default setting.
    3. Confirm the specifications, and click Next and then Submit. The VPC endpoint list page is displayed.

  3. Create a private DNS zone.

    The newly created real-time service is interconnected with a dedicated gateway. The independent public domain name of ModelArts inference, that is, infer-modelarts-<Region ID>.modelarts-infer.com, is required. The intranet VPC cannot resolve the modelarts-infer.com domain name. You need to add private domain name resolution by referring to this step and 4.
    1. Log in to the DNS console. In the navigation pane on the left, choose Private Zones.
    2. Click Create Private Zone. Set the following parameters:
      • Domain Name: Enter a value in the format infer-modelarts-<Region ID>.modelarts-infer.com. Example: infer-modelarts-cn-south-1.modelarts-infer.com.
      • VPC: Select a VPC you want to associate with the private zone.
    3. Click OK.

  4. Access the real-time service through the VPC.

    1. Use the following API to access a real-time service through VPC:
      https://{Private DNS domain name}/{URL}
      • Private DNS domain name: private domain name you set. You can also click Access VPC on the real-time service list page to view the domain name in the displayed dialog box.
      • URL: The URL for a real-time service is the part after the domain name of API URL in the Usage Guides tab of the service details page.
        Figure 1 Obtaining the URL
    2. Use GUI-based software, cURL command, or Python to access a real-time service. For details, see Accessing a Real-Time Service Through Token-based Authentication.