All Products
Search
Document Center

ActionTrail:Call API operations over a VPC

Last Updated:Aug 27, 2026

If an ECS instance in a virtual private cloud (VPC) is not assigned a public IP address, the instance cannot call ActionTrail API operations over the Internet. Call the API operations over a VPC instead.

Prerequisites

  • An ECS instance in a VPC. API requests are sent from this instance.

  • Version 4.5.3 or later of the core library of the Java SDK, if you use the Java SDK method.

Limits

You can manage resources only in the same region as the ActionTrail VPC endpoint that you call. Cross-region operations are not supported.

Method 1 (recommended): Call an API operation by using the Java SDK

The Java SDK method applies to Java applications. The following code calls the ActionTrail DescribeRegions operation over a VPC:

DefaultProfile profile = DefaultProfile.getProfile("<RegionId>", "<AccessKeyId>", "<AccessKeySecret>");
IAcsClient client = new DefaultAcsClient(profile);
// A global configuration. For ActionTrail, the product name is Actiontrail.
DefaultProfile.addEndpoint("<RegionId>", "Actiontrail", "<Endpoint>");
// Call the DescribeRegions operation.
DescribeRegionsRequest regionsRequest = new DescribeRegionsRequest();
// A configuration that takes effect only for the current request.
// Set the network. Valid values of the productNetwork parameter: vpc and public.
// vpc: calls the API operation over a VPC. public: calls the API operation over the Internet. This is the default value.
regionsRequest.productNetwork = "vpc";
DescribeRegionsResponse regionsResponse = client.getAcsResponse(regionsRequest);

Configure the endpoint at either of the following levels:

  • Global configurationDefaultProfile.addEndpoint sets the endpoint globally. For ActionTrail, set the product name to Actiontrail. Replace <Endpoint> with the VPC endpoint of the region whose resources you want to manage. For the endpoint of each region, see VPC endpoints.

  • Per-request configurationproductNetwork takes effect only for the current request. Valid values: vpc and public. Set the value to vpc to call the operation over a VPC. The default value, public, calls the operation over the Internet. To set the endpoint for the current request instead, call setSysEndpoint.

Note

If you set productNetwork to vpc, you do not need to call setSysEndpoint to specify the endpoint for the request.

Method 2: Call an API operation by using Alibaba Cloud CLI

Run the following command to call the DescribeRegions operation over a VPC. The command uses the VPC endpoint of the China (Hangzhou) region:

aliyun actiontrail DescribeRegions --endpoint actiontrail-vpc.cn-hangzhou.aliyuncs.com

The --endpoint option specifies the endpoint that the request is sent to. Replace actiontrail-vpc.cn-hangzhou.aliyuncs.com with the VPC endpoint of the region whose resources you want to manage. For the endpoint of each region, see VPC endpoints.

VPC endpoints

The VPC endpoints of ActionTrail use the format actiontrail-vpc.<region-id>.aliyuncs.com. The following table lists the VPC endpoint of each region.

Alibaba Cloud regionRegion IDEndpoint
China (Hangzhou)cn-hangzhouactiontrail-vpc.cn-hangzhou.aliyuncs.com
China (Shanghai)cn-shanghaiactiontrail-vpc.cn-shanghai.aliyuncs.com
China (Qingdao)cn-qingdaoactiontrail-vpc.cn-qingdao.aliyuncs.com
China (Beijing)cn-beijingactiontrail-vpc.cn-beijing.aliyuncs.com
China (Zhangjiakou)cn-zhangjiakouactiontrail-vpc.cn-zhangjiakou.aliyuncs.com
China (Hohhot)cn-huhehaoteactiontrail-vpc.cn-huhehaote.aliyuncs.com
China (Shenzhen)cn-shenzhenactiontrail-vpc.cn-shenzhen.aliyuncs.com
China (Heyuan)cn-heyuanactiontrail-vpc.cn-heyuan.aliyuncs.com
China (Guangzhou)cn-guangzhouactiontrail-vpc.cn-guangzhou.aliyuncs.com
China (Chengdu)cn-chengduactiontrail-vpc.cn-chengdu.aliyuncs.com
China (Hong Kong)cn-hongkongactiontrail-vpc.cn-hongkong.aliyuncs.com
Singaporeap-southeast-1actiontrail-vpc.ap-southeast-1.aliyuncs.com
Malaysia (Kuala Lumpur)ap-southeast-3actiontrail-vpc.ap-southeast-3.aliyuncs.com
Indonesia (Jakarta)ap-southeast-5actiontrail-vpc.ap-southeast-5.aliyuncs.com
Japan (Tokyo)ap-northeast-1actiontrail-vpc.ap-northeast-1.aliyuncs.com
Germany (Frankfurt)eu-central-1actiontrail-vpc.eu-central-1.aliyuncs.com
UK (London)eu-west-1actiontrail-vpc.eu-west-1.aliyuncs.com
US (Silicon Valley)us-west-1actiontrail-vpc.us-west-1.aliyuncs.com
US (Virginia)us-east-1actiontrail-vpc.us-east-1.aliyuncs.com
UAE (Dubai)me-east-1actiontrail-vpc.me-east-1.aliyuncs.com