IP access control is one of the API security components provided by the API Gateway and controls the source IP addresses (or IP address segments) that can call APIs. You can add an IP address to the whitelist or blacklist of an API to permit or reject the API requests from this IP address.
- A whitelist can contain IP addresses or its combination with application IDs. Requests from IP addressed not listed on whitelist will be rejected.
- For IP addresses, only IP addresses from specified source are allowed to visit.
- For IP address and application ID combinations, application IDs can only visit from their combined IP addresses. Visits from other IP addresses will be rejected.
- Requests from IP addresses on the blacklist will be rejected by API Gateway.
Create an IP access control policy and bind it to the API to which the access needs to be controlled.
Open API Gateway Console and choose “Publish APIs” > “IP Access Control”.
Click “Create IP Control Policy” to display the access control creation window.
Enter the required information and click “OK”.
- If you set the access control type to Allow, you are configuring a whitelist.
- If you set the access control type to Refuse, you are configuring a blacklist.
After you create a whitelist or blacklist, you must enter the control policies corresponding to the list type. For a whitelist, you can enter the application ID, IP address, or combination of an application ID and an IP address. For a blacklist, enter an IP address.
Click “OK” to complete the configuration.
Bind the IP control policy to an API for the policy to take effect.
On the IP control policy list:
Find the required policy and bind API.
Select the corresponding API to bind the policy to it.
NOTE: Each API can have only one access control policy bound to it, no matter whether the policy is a blacklist or whitelist.
Select a policy from the IP control policy list and delete it.
NOTE: If an IP control policy has been bound to an API, unbind it from the API before deleting it.
You can find the API to which a policy is bound on the IP access control details page.
When will the operation of binding or deleting an IP control policy take effect?
On the API Gateway, a policy binding operation takes effect immediately.
Can an API have different IP control policies bound in different environments?
Yes. You can bind different IP control policies to an API in different environments. We recommend that you bind a specified IP address to the test environment and pre-release environment to ensure security of the test environment.
Why is application blacklist not supported?
API calls require application authorization. To prohibit API calls for an application, you only need to delete its authorization. Therefore, application blacklist is not needed.