If an Elastic Compute Service (ECS) instance in a virtual private cloud (VPC) is not assigned a public IP address, you cannot call API operations on the ECS instance over the Internet. Instead, you can call API operations over the VPC.
Endpoints
You can call API operations over a VPC. The following table describes the available VPC endpoints. You must use the endpoint of the VPC where your ECS instance resides. You cannot call API operations across regions.
Alibaba Cloud region | Region ID | Endpoint |
China (Hangzhou) | cn-hangzhou | actiontrail-vpc.cn-hangzhou.aliyuncs.com |
China (Shanghai) | cn-shanghai | actiontrail-vpc.cn-shanghai.aliyuncs.com |
China (Qingdao) | cn-qingdao | actiontrail-vpc.cn-qingdao.aliyuncs.com |
China (Beijing) | cn-beijing | actiontrail-vpc.cn-beijing.aliyuncs.com |
China (Zhangjiakou) | cn-zhangjiakou | actiontrail-vpc.cn-zhangjiakou.aliyuncs.com |
China (Hohhot) | cn-huhehaote | actiontrail-vpc.cn-huhehaote.aliyuncs.com |
China (Shenzhen) | cn-shenzhen | actiontrail-vpc.cn-shenzhen.aliyuncs.com |
China (Heyuan) | cn-heyuan | actiontrail-vpc.cn-heyuan.aliyuncs.com |
China (Guangzhou) | cn-guangzhou | actiontrail-vpc.cn-guangzhou.aliyuncs.com |
China (Chengdu) | cn-chengdu | actiontrail-vpc.cn-chengdu.aliyuncs.com |
China (Hong Kong) | cn-hongkong | actiontrail-vpc.cn-hongkong.aliyuncs.com |
Singapore | ap-southeast-1 | actiontrail-vpc.ap-southeast-1.aliyuncs.com |
Malaysia (Kuala Lumpur) | ap-southeast-3 | actiontrail-vpc.ap-southeast-3.aliyuncs.com |
Indonesia (Jakarta) | ap-southeast-5 | actiontrail-vpc.ap-southeast-5.aliyuncs.com |
Japan (Tokyo) | ap-northeast-1 | actiontrail-vpc.ap-northeast-1.aliyuncs.com |
Germany (Frankfurt) | eu-central-1 | actiontrail-vpc.eu-central-1.aliyuncs.com |
UK (London) | eu-west-1 | actiontrail-vpc.eu-west-1.aliyuncs.com |
US (Silicon Valley) | us-west-1 | actiontrail-vpc.us-west-1.aliyuncs.com |
US (Virginia) | us-east-1 | actiontrail-vpc.us-east-1.aliyuncs.com |
UAE (Dubai) | me-east-1 | actiontrail-vpc.me-east-1.aliyuncs.com |
Method 1: Use Alibaba Cloud SDKs to call an API operation over a VPC (Recommended)
Use the core library of Alibaba Cloud SDK for Java version 4.5.3 or later to call API operations over a VPC. Sample code in Java:
DefaultProfile profile = DefaultProfile.getProfile("<RegionId>", "<AccessKeyId>", "<AccessKeySecret>");
IAcsClient client = new DefaultAcsClient(profile);
// The configuration takes effect globally. <product> specifies the service name. ActionTrail is used in this example.
DefaultProfile.addEndpoint("<RegionId>", "<product>", "<Endpoint>");
// The configuration takes effect only for this request. For example, you can call the DescribeRegions operation in this request by using the following configuration:
DescribeRegionsRequest regionsRequest = new DescribeRegionsRequest();
// If you have set the productNetwork parameter, you do not need to set the SysEndpoint parameter.
regionsRequest.setSysEndpoint("<Endpoint>");
// Configure the network. Valid values of the productNetwork parameter: vpc and public.
// Set the parameter to vpc when you call the operation over an internal network. Set the parameter to public when you call the operation over the Internet. Default value: public.
regionsRequest.productNetwork = "vpc";
DescribeRegionsResponse regionsResponse = client.getAcsResponse(regionsRequest);
Method 2: Use Alibaba Cloud CLI to call an API operation
The DescribeRegions operation is used in this example. Sample command:
aliyun actiontrail DescribeRegions --endpoint actiontrail-vpc.cn-hangzhou.aliyuncs.com