If you need fine-grained control over traffic from your private assets to the Internet, you can configure nat firewall access control policies. These policies block unauthorized access to the Internet from your private assets to reduce risks such as the leakage of core business data. This tutorial shows how to configure an access control policy that allows a private instance to access only a specific domain name.
Scenario
This tutorial uses the following scenario: An ECS instance with the private IP address 10.10.XX.XX accesses the Internet through a nat gateway. For security, you will configure a policy that allows the instance to access only the www.aliyun.com website.
Procedure
Log on to the Cloud Firewall console.
In the navigation pane on the left, choose .
On the NAT Border page, select the NAT Gateway that you want to configure and click Create Policy.
Cloud Firewall automatically syncs the NAT gateways that are associated with your Alibaba Cloud account. You can click the drop-down list to select the NAT Gateway that you want to configure.

In the Create Policy - NAT Border panel, create two policies: a high-priority policy that allows the instance to access www.aliyun.com and a low-priority policy that denies the instance from accessing all other Internet destinations.
Create a policy that allows the
instanceto access www.aliyun.com. Use the following key settings:Source: 10.10.XX.XX/32
Destination Type: Domain Name
Destination: www.aliyun.com
Domain Name Identification Mode: FQDN-based Resolution (Extract Host or SNI Field in Packets)
Protocol Type: TCP
Port: 443/443
Application: HTTPS
Action: Allow
Priority: Highest
Create a policy to deny the
instanceaccess to all public IP addresses. Use the following key settings:Source: 10.10.XX.XX/32
Destination: 0.0.0.0/0, which represents all IP addresses
Protocol Type: ANY
Port: 0/0, which represents all ports
Application: ANY
Action: Deny
Priority: Lowest
After configuring the policies, ensure the policy allowing access to www.aliyun.com has a higher priority than the policy denying access to all Internet destinations.
Next steps
After your service has been running for a period of time, you can view the hit count and last hit time of access control policies in the Hits / Last Hit At column of the access control policy list.
Click the hit count to view the traffic logs on the Traffic Logs page. For more information, see Log audit.

Related documentation
For detailed instructions on configuring
access control policiesfor anat firewall, see Configure NAT Border Access Control Policies.For more principles and examples of configuring
access control policies, see Access control policy configuration examples.For more information about configuring and using
access control policies, see FAQ about access control policies.