You can add, view, modify, and disable IP address whitelists for the cloud product interconnection network and VPCs in a MaxCompute project. Only users with the Project Owner or Super_Administrator role, or a custom role that has IP address whitelist management permissions, can perform these operations.
Background
MaxCompute provides multiple layers of security, including multi-tenancy and authentication for projects. You can access and compute data within your authorized scope only after your AccessKey ID and AccessKey Secret are authenticated.
In addition to authentication, MaxCompute allows you to configure an IP address whitelist for enhanced security. When this feature is enabled, only requests from whitelisted IP addresses are accepted. All other requests are denied, even if they carry a valid AccessKey ID and AccessKey Secret.
If you do not enable the IP address whitelist feature for a MaxCompute project, you can still access the project. Access is controlled as follows:
-
Cloud product interconnection network: All IP addresses that use the cloud product interconnection network endpoint within the same Alibaba Cloud account and region can access the project.
-
VPC: All IP addresses that use the VPC endpoint within the same VPC can access the project.
-
Public network: All IP addresses that use the public network endpoint can access the project.
-
IP address whitelist for the cloud product interconnection network
-
If you use the MaxCompute client to access a project, add the IP address of the device where the MaxCompute client is installed.
-
If you use an application to access a project, add the application server's IP address to the whitelist.
-
If you access a project through a proxy server or a multi-hop proxy server, add the last-hop proxy server's IP address to the whitelist.
-
If you use DataWorks, add the IP addresses of the exclusive resource group for DataWorks and other related IP addresses to the whitelist.
-
-
IP address whitelist for a VPC
Before you configure an IP address whitelist for a VPC, complete the following steps:
-
Obtain the VPC instance ID.
-
Configure an endpoint for the VPC. For more information, see Endpoints.
-
Add the IP addresses of all services that need to access MaxCompute to the whitelist. For example, if you use Data Integration, Data Map, or Realtime Compute for Apache Flink, you must add the IP addresses of these services to the whitelist.
-
MaxCompute supports only project-level IP address whitelists. The following formats are supported:
-
An IPv4 or IPv6 address. Examples: 192.168.0.0 and 2001:db8::.
-
A CIDR block. Examples: 172.12.0.0/16 and 2001:db8::/32.
-
An IP address range. Examples: 192.168.10.0-192.168.255.255 and 2001:db8:1:1:1:1:1:1-2001:db8:4:4:4:4:4:4.
Add an IP address whitelist
You can add an IP address whitelist by using the MaxCompute client (CLI) or the console.
By using the CLI
The parameter for the IP address whitelist for the public network and cloud product interconnection network is odps.security.ip.whitelist. The parameter for VPCs is odps.security.vpc.whitelist. For more information about the command syntax and parameters, see View project properties.
Run the following commands to add IP addresses to an IP address whitelist:
-
If you configure an IP address whitelist only for the public network and the cloud product interconnection network, access from these networks is restricted, and all access from VPCs is denied.
setproject odps.security.ip.whitelist=192.168.0.0 odps.security.vpc.whitelist=\N;To restrict access only from non-VPC networks without limiting access from VPCs, you can use the asterisk (
*) wildcard character for VPCs:setproject odps.security.ip.whitelist=192.168.0.0 odps.security.vpc.whitelist=*;When you configure the IP address whitelist for the public network and cloud product interconnection network, include the IP address of the device where you run the MaxCompute client to avoid blocking your own access. If the configured whitelist does not include the VPC from which you are making the request, the command fails with a risk warning. Example:
odps@ xxx>setproject odps.security.ip.whitelist=192.168.1.xxx; FAILED: Yourself will be banned by your new IP/VPC whitelist! Test result: vpc:'cn-hangzhou_123' or '123' not in vpc white list. project: lyh_meta1 -
If you configure an IP address whitelist only for a VPC, access from the VPC is restricted, and all access from the public network and the cloud product interconnection network is denied.
setproject odps.security.ip.whitelist=\N odps.security.vpc.whitelist=<vpc-instance-id>[192.168.0.10,192.168.0.20];To configure access control only for a VPC without disabling access from non-VPC networks, you can use the
0.0.0.0/0wildcard IP address:setproject odps.security.ip.whitelist=0.0.0.0/0 odps.security.vpc.whitelist=<vpc-instance-id>[192.168.0.10,192.168.0.20]; -
If you need to configure IP address whitelists for both the public network/cloud product interconnection network and a VPC, access from both network types is restricted.
setproject odps.security.ip.whitelist=192.168.0.0 odps.security.vpc.whitelist=<vpc-instance-id>[192.168.0.10,192.168.0.20]; -
If you need to configure whitelists with multiple IP addresses for the public network/cloud product interconnection network and multiple VPCs, use the following format.
setproject odps.security.ip.whitelist=192.168.0.0,192.168.0.10 odps.security.vpc.whitelist=<vpc-instance-id1>[192.168.0.10,192.168.0.20],<vpc-instance-id2>;Separate multiple public network or cloud product interconnection network IP addresses with commas (,). For VPC IP addresses, use the format
<VPC instance ID>[IP address list]. To whitelist all IP addresses from a specific VPC, specify only its VPC instance ID.
Whitelist changes take effect within about five minutes.
By using the console
In the MaxCompute console, select your region. On the Projects page, find your project and click Manage in the Actions column. Then, on the Parameter Configuration tab, edit the IP Address Whitelist.
-
Public network and cloud product interconnection network IP: Separate multiple IP addresses with commas (,). If you configure an IP address whitelist only for the public network and the cloud product interconnection network, access from these networks is restricted, and all access from VPCs is denied. If you do not want to restrict access from VPCs, you can set the "VPC network IP" parameter to the asterisk (
*) wildcard character. -
VPC network IP: Separate multiple IP addresses with commas (,). If you configure an IP address whitelist only for a VPC, access from the VPC is restricted, and all access from the public network and the cloud product interconnection network is denied. Example:
<vpc-instance-id1>[192.168.0.10,192.168.0.20],<vpc-instance-id2>. To configure access control only for the VPC without disabling access from non-VPC networks, set the "Public network and cloud product interconnection network IP" parameter to the0.0.0.0/0wildcard.
View IP address whitelists
Run the setproject; command to view the IP address whitelist. The odps.security.ip.whitelist= and odps.security.vpc.whitelist parameters list the whitelisted IP addresses. If the value of odps.security.ip.whitelist= or odps.security.vpc.whitelist is empty, no IP address whitelist is configured.
setproject;
The following output is returned:
odps.security.ip.whitelist=192.168.0.0
odps.security.vpc.whitelist=<vpc-instance-id>[192.168.0.10,192.168.0.20]
If you configured the VPC IP address whitelist by using the legacy format (Region ID + numeric VPC ID), the output is similar to the following:
odps.security.vpc.whitelist=cn-beijing_125179[192.168.0.10,192.168.0.20]
The Region ID part is used only as an identifier. Therefore, cn-beijing_1234, cn_1234, cn-shanghai_1234, and 1234 are all treated the same and are equivalent to using the corresponding VPC instance ID. We strongly recommend that you switch to using the VPC instance ID format. If you have configured IP lists for the same VPC using multiple formats, the effective IP list is the union of all configurations, so they can coexist. If you need to confirm the mapping between legacy numeric IDs and VPC instance IDs, you can submit a support ticket.
Modify an IP address whitelist
Run the setproject command to modify the IP address whitelists for the public network, cloud product interconnection network, and VPCs. This command replaces the existing whitelist with the new values.
Important: This command replaces the entire whitelist. To add IP addresses, include both the existing and new addresses in the command.
-
Modify the IP address whitelist for the public network and cloud product interconnection network
setproject odps.security.ip.whitelist=192.168.0.10; -
Modify the IP address whitelist for a VPC
setproject odps.security.vpc.whitelist=<vpc-instance-id>[192.168.10.10,192.168.0.20];
Disable an IP address whitelist
Run the following command to disable the IP address whitelist feature. This removes all access restrictions for the public network, cloud product interconnection network, and VPCs.
setproject odps.security.ip.whitelist= odps.security.vpc.whitelist= ;
To disable the IP address whitelist feature, you must clear both the public network/cloud product interconnection network whitelist and the VPC whitelist.
Whitelist for Alibaba Cloud services
Run the following command to allow all Alibaba Cloud services to access MaxCompute over the cloud product interconnection network or a VPC:
setproject odps.security.ip.whitelist=192.168.0.0/16,172.16.0.0/12,10.0.0.0/8,11.0.0.0/8,33.0.0.0/8,26.0.0.0/8,100.64.0.0/10 odps.security.vpc.whitelist=*;
-
odps.security.ip.whitelist: The IP address whitelist for the public network and cloud product interconnection network. You can use the IP addresses in the command above. To add more IP addresses, append them to the list.
Region ID
The following table lists the Alibaba Cloud Region IDs.
|
Region |
Region ID |
|
China (Hangzhou) |
cn-hangzhou |
|
China (Shanghai) |
cn-shanghai |
|
China (Beijing) |
cn-beijing |
|
China (Zhangjiakou) |
cn-zhangjiakou |
|
China (Ulanqab) |
cn-wulanchabu |
|
China (Shenzhen) |
cn-shenzhen |
|
China (Chengdu) |
cn-chengdu |
|
China (Hong Kong) |
cn-hongkong |
|
China East 2 Finance |
cn-shanghai-finance-1 |
|
China North 2 Ali Gov 1 |
cn-north-2-gov-1 |
|
China South 1 Finance |
cn-shenzhen-finance-1 |
|
Japan (Tokyo) |
ap-northeast-1 |
|
Singapore |
ap-southeast-1 |
|
Malaysia (Kuala Lumpur) |
ap-southeast-3 |
|
Indonesia (Jakarta) |
ap-southeast-5 |
|
Germany (Frankfurt) |
eu-central-1 |
|
UK (London) |
eu-west-1 |
|
US (Silicon Valley) |
us-west-1 |
|
US (Virginia) |
us-east-1 |
|
UAE (Dubai) |
me-east-1 |
Troubleshooting whitelist errors
-
If an IP address whitelist for the public network or cloud product interconnection network blocks access, you will receive the following error:
FAILED: Access denied by project ip white list: sourceIP:'xxxxx' is not in white list. project: xxxThis indicates that the source IP address (sourceIP) is not in the whitelist for the public network or cloud product interconnection network, and the project is identified in the error message as
project: xxx.Add
sourceIPto the public network and cloud product interconnection network IP address whitelist for the project. -
If the VPC IP address whitelist restricts access, the following errors are reported:
-
The VPC is not in the IP address whitelist:
FAILED: Access denied by project vpc white list: vpc:'vpc-xxx' not in vpc white list, ip: 'xxxx'. project: xxxThis error indicates that the VPC initiating the request is not in the whitelist. The
project: xxxfield in the error message identifies the project.Add this VPC instance ID to the VPC IP address whitelist of the project.
-
The VPC is in the IP address whitelist, but the source IP address is not:
FAILED: Access denied by project vpc white list: sourceIP:'xxxxx' from vpc 'vpc-xxx' is not in vpc white list. project: xxxThis error indicates that the source VPC is in the IP address whitelist, but the source IP address is not. The
project: xxxfield in the error message identifies the project.Add this VPC IP address to the VPC IP address whitelist of the project.
-