Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Implementation Procedure

Updated on 2025-01-16 GMT+08:00

Creating a VPC

  1. Log in to the network console.
  2. In the navigation pane, choose Virtual Private Cloud > My VPCs.
  3. On the Virtual Private Cloud page, click Create VPC, and configure the parameters by referring to Table 1 and Table 2. For details, see sections "Creating a VPC" and "Creating a Subnet for the VPC" in the Virtual Private Cloud User Guide.

    Table 1 Configuration information

    Parameter

    Description

    Region

    Select a region.

    Name

    Enter VPC1. This VPC will be used to run a gateway.

    Enterprise Project

    Select default.

    Name

    A subnet is automatically created when you create a VPC.

    Table 2 VPC CIDR block planning

    VPC 1

    VPC of APIG

    VPC 2

    10.X

    172.31.0.0/16

    Must be different from VPC 1 and the VPC of the gateway.

    172.X

    192.168.0.0/16

    192.X

    172.31.0.0/16

  4. Click Create Now.
  5. Repeat 3 to 4 to create VPC2 for running your backend service.

Creating a Gateway

  1. Go to the APIG console.
  2. In the navigation pane, choose Gateways.
  3. Click Buy Gateway.

    Table 3 Gateway information

    Parameter

    Description

    Billing Mode

    Billing mode of the gateway. Select Pay-per-use.

    Region

    Select the region where the gateway is located. It must be the same as the region of VPC 1.

    AZ

    The AZ where the gateway is located. Select AZ1.

    Gateway Name

    Name of the gateway.

    Edition

    Select Professional. The edition cannot be changed after the gateway is created.

    Scheduled Maintenance

    Select a time period when the gateway can be maintained by technical support engineers. A period with low service traffic is recommended. For this example, retain the default value 22:00:00---02:00:00.

    Enterprise Project

    Select the enterprise project to which the gateway belongs. For this example, retain the default value default.

    Network

    Select VPC 1 and a subnet.

    Security Group

    Click Manage Security Groups and create a security group. Ensure that you have selected default for Enterprise Project.

    Description

    Description of the gateway.

  4. Click Next.
  5. If the gateway configurations are correct, read and confirm your acceptance of the customer agreement and privacy statement, and create the instance.

Creating a Load Balancer

  1. Return to the network console.
  2. In the navigation pane, choose Elastic Load Balance > Load Balancers.
  3. Click Buy Elastic Load Balancer.
  4. Configure the load balancer information. For details, see section Load Balancer in the Elastic Load Balance User Guide.

    Table 4 Load balancer parameters

    Parameter

    Description

    Type

    Type of the load balancer.

    Billing Mode

    By default, Pay-per-use is selected.

    Region

    Select the region where the load balancer is located. It must be the same as the region of VPC 2.

    AZ

    The AZ where the load balancer is located. Select AZ1.

    Name

    Name of the load balancer.

    Enterprise Project

    Select default.

    Specification

    Select FixedApplication load balancing (HTTP/HTTPS) and Network load balancing (TCP/UDP) by default.

    Network Type

    Select Private IPv4 network by default.

    VPC

    Select VPC 2.

    Frontend Subnet

    Select a subnet.

  5. Click Next.
  6. Confirm the configuration and click Submit.
  7. Add a listener.

    1. Click the name of the load balancer. On the Listeners tab page, click Add Listener.
    2. Configure the listener name, frontend protocol, and port, and click Next.
    3. Configure the backend server group name, backend protocol, and load balancing algorithm. Then click Next.
    4. Add backend servers and click Next.
    5. Click Submit. The following figure shows the configuration.
    Figure 1 Viewing the basic information and backend server group of the listener

Creating a VPC Peering Connection

  1. In the navigation pane, choose Virtual Private Cloud > VPC Peering Connections.
  2. Click Create VPC Peering Connection and configure the parameters.

    Table 5 Configuring a VPC peering connection

    Parameter

    Description

    Region

    Select a region that is the same as the region of VPC 1.

    VPC Peering Connection Name

    Name of the VPC peering connection.

    Local VPC

    Select VPC 1.

    Account

    By default, My account is selected.

    Peer Project

    Select a project

    Peer VPC

    Select VPC 2.

  3. Click OK.
  4. In the displayed dialog box, click Add Now to go to the VPC peering connection details page.
  5. On the Associated Routes area, click Add Route.

    1. In the displayed dialog box, enter the route information.
      Table 6 Local and peer routing information

      Parameter

      Description

      Local routes

      VPC

      Select VPC 1.

      Route Table

      VPC 1 route table

      Destination

      Enter the service address displayed on the details page of the load balancer.

      Peer routes

      VPC

      Select VPC 2.

      Route Table

      VPC 2 route table

      Destination

      Enter the private outbound address displayed on the details page of the dedicated gateway.

    2. Click OK.

Configuring a Route

  1. Return to the APIG console.
  2. In the navigation pane, choose Gateways.
  3. Click the name of the created dedicated gateway or click Access Console.
  4. Click Change in the Routes area, enter the IPv4 CIDR block of VPC 2 where the load balancer you created is located.
  5. Click Save.

Creating an API

  1. On the APIG console, choose API Management > APIs, and click Create API > Create API.
  2. Configure the frontend information and click Next.

    Table 7 Frontend configuration

    Parameter

    Description

    API Name

    Enter an API name.

    Group

    The default option is DEFAULT.

    URL

    • Method: Request method of the API. Set this parameter to GET.
    • Protocol: Request protocol of the API. Set this parameter to HTTPS.
    • Subdomain Name: The system automatically allocates a subdomain name to each API group for internal testing. The subdomain name can be accessed 1,000 times a day.
    • Path: Path for requesting the API.

    Gateway Response

    Select a response to be displayed if the gateway fails to process an API request.

    The default gateway response is default.

    Authentication Mode

    API authentication mode. Select None. (None: Not recommended for actual services. All users will be granted access to the API.)

  3. Configure the backend information and click Next.

    Table 8 Parameters for defining an HTTP/HTTPS backend service

    Parameter

    Description

    Load Balance Channel

    Determine whether the backend service will be accessed using a load balance channel. For this example, select Skip.

    URL

    • Method: Request method of the API. Set this parameter to GET.
    • Protocol: Set this parameter to HTTP.
    • Backend Address: Enter the service address of the load balancer you created.
    • Path: Path of the backend service.

  4. Define the response and click Finish.

Creating an ECS

  1. Log in to the cloud server console.
  2. Click Buy ECS.
  3. Configure the basic settings and click Next: Configure Network.

    Table 9 Basic settings

    Parameter

    Description

    Billing Mode

    Select Pay-per-use.

    Region

    Select the region where the ECS is located. It must be the same as the region of VPC 2.

    AZ

    Select the AZ where the ECS is located.

    CPU Architecture

    The default option is x86.

    Specifications

    Select specifications that match your service planning.

    Image

    Select an image that matches your service planning.

    VPC

    Select VPC 2.

    Primary NIC

    Select the subnet of the created VPC.

    Security Group

    Select the security group created for the dedicated gateway.

    EIP

    Select Not required.

    ECS Name

    Enter an ECS name.

    Login Mode

    Credential for logging in to the ECS. The default option is Password.

    Username

    The default user is root.

    Password

    Set a password for logging in to the ECS.

    Confirm Password

    Enter the password again.

    Enterprise Project

    Select "default".

  4. Read and confirm your acceptance of the agreement. Then click Create.

Debugging the API

  1. In the load balancer listener details, click View/Add Backend Server.
  2. On the Backend Servers page, add the created ECS.
  3. Go to the API Management > APIs page of the dedicated gateway, and choose More > Debug in the row that contains the API you created.
  4. Enter the request parameters and click Debug.

    If the status code is 200, the debugging is successful. Otherwise, rectify the fault by following the instructions provided in Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback