Help Center/ Cloud Application Engine/ Best Practices/ Guide to Configure CAE Access Modes/ Scenario 2: Accessing CAE Components from an ECS in the Same VPC
Updated on 2025-11-03 GMT+08:00

Scenario 2: Accessing CAE Components from an ECS in the Same VPC

Scenario

If a component needs to be called by other services or monitoring or O&M tools in the microservice cluster, you must configure ports for other components to access this component to ensure that the component can be accessed by external systems.

After configuring the port for other components to access this component, you can use an ECS in the VPC to access the CAE component. This ensures data security by keeping all interactions within the VPC private network, preventing exposure to the public network.

This section describes how to access CAE components from an ECS in the same VPC.

Restrictions

This function is available only in CN North-Beijing4, CN South-Guangzhou, CN East-Shanghai1, ME-Riyadh, TR-Istanbul, AF-Johannesburg, LA-Mexico City2, and LA-Sao Paulo1.

Prerequisites

  • You have configured the domain name for accessing the component and configured the external access to the component by referring to Scenario 1: Accessing CAE Components from the Public Network. If the HTTP and HTTPS scenarios are involved, configure the parameters according to the HTTPS scenario.
  • You have purchased an ECS, and the VPC bound to the ECS must be the same as the VPC to which the CAE environment belongs. For details about how to purchase an ECS, see Introducing ECS Purchase Options.

Step 1: Configure the hosts File on the ECS to Resolve a Specific Domain Name to a Specified IP Address

  1. Obtaining the internal IP address of the load balancer selected during environment creation

    1. Log in to CAE.
    2. Choose Overview.
    3. At the bottom of the overview page, click the name of the load balancer to go to the ELB console.
    4. Click the Summary tab.
    5. Find and copy the value of Private IPv4 address of the load balancer. Example value: 10.20.30.xx

  2. Obtaining the public IP address domain name of the CAE component

    1. Choose Component Configurations.
    2. On the displayed page, find and copy the public IP address access domain name cae-test.abc.com from Access Mode.

  3. Configuring the hosts file to resolve a specific domain name to a specified IP address

    1. Log in to the ECS console.
    2. Find a running ECS. The VPC bound to the ECS must be the same as the VPC to which the CAE environment belongs.

      Click Remote Login on the right. For details about how to remotely log in to an ECS, see Logging In to a Linux ECS Using CloudShell.

    3. Click Log In.
    4. Enter the login information and click Connect.
    5. Run the following command to open the hosts file:
      vi /etc/hosts  # Open the /etc/hosts file
    6. Run the following command to resolve a specified domain name to a specified IP address:
      10.20.30.xx cae-test.abc.com # Local mapping: public IP address access domain name corresponding to the private IP address of the CAE component
    7. Press Esc and run the following command:
      :wq # Save the file and exit the editor

Step 2: Access the CAE Component from the ECS

  1. On the ECS, enter the following command to access the intranet address:

    curl -kv https://cae-test.abc.com  # Initiate a network request.

  2. Press Enter to access the target CAE component.