A firewall template is a reusable collection of firewall rules that you can apply to one or more instances at once. Define rules once in a template and apply it to multiple instances instead of configuring each instance individually.
Limitations
-
You can create up to 50 firewall templates in each region.
-
You can add up to 50 firewall rules to each firewall template.
-
You can add up to 50 firewall rules to each Simple Application Server instance.
-
You can apply a firewall template to up to 10 Simple Application Server instances at a time.
Create a firewall template
-
Go to the Firewall Templates page in the Simple Application Server console.
-
On the Firewall Templates tab, click Create Template.
The following table describes the parameters.
Parameter
Description
Name
Enter a name for the firewall template.
Description (Optional)
Enter a description to help you manage the firewall template.
Firewall rule
Application Type
Select an application type.
Protocol
TCP, UDP, and ICMP are supported.
NoteIf you select ICMP, you must allow all ports (i.e., -1) and access from any source IP address (0.0.0.0/0).
Port Range
Valid values: 1 to 65535. The following formats are supported:
-
Specify a single port
Enter the port number that you want to allow. For example, to allow traffic on port 3306 for a MySQL database, set the port range to
3306. -
Specify a port range
You can specify a port range separated by a forward slash (/). For example, to allow a port range from 20000 to 30000 that is manually configured in an FTP configuration file, set the port range to
20000/30000.
Source IP Address
The default value is 0.0.0.0/0, which allows access from all IPv4 addresses.
ImportantTo reduce the risk of network attacks, configure this parameter based on the principle of least privilege.
Policy
The default value is Allow and cannot be changed.
Remarks
Enter remarks about the firewall rule.
To add multiple firewall rules to the template, click Add Rule to add more rules.
You can click One-Click Enable to use presets and quickly allow common ports.
NoteA firewall template can contain a maximum of 50 firewall rules.
-
-
Click Create Template.
NoteAfter you click One-Click Enable, you must delete the empty, automatically added rule. Otherwise, the Create Template button is disabled.
After you create a firewall template, you can use it to configure an instance's firewall. For more information, see Apply a firewall template.
Modify a firewall template
Add, modify, or delete firewall rules in an existing template, then apply the updated template to instances.
Changes to a firewall template do not affect instances that already use it.
-
Go to the Firewall Templates page in the Simple Application Server console.
-
On the Firewall Templates tab, click the ID of the firewall template.
-
On the Rule List tab, you can add, modify, or delete firewall rules.
Add a rule
-
Click Add Rule.
-
In the lower-left corner of the Add Rule panel that appears, click Add Rule or One-Click Enable.
-
Configure the firewall rule. For parameter details, see parameter details.
-
Click OK.
Modify a rule
-
In the Actions column for the target firewall rule, click Modify Rule.
-
In the Modify Rule dialog box, modify the source IP address, protocol, port range, or remarks.
-
Click OK.
-
In the Modify Rule dialog box that appears, The rule is modified. is displayed. Click Close.
Delete rules
-
In the Actions column for the target firewall rule, click Delete.
You can also select multiple firewall rules and click Batch Delete in the lower-left corner.
-
In the Delete dialog box, click OK.
-
In the Delete dialog box, a message is displayed to indicate that x rules are deleted successfully. Click Close.
-
Apply a firewall template
Apply a firewall template to configure firewall rules on one or more Simple Application Server instances at once.
If a rule in the template matches an existing rule on an instance (same port, protocol, and IP address), the template's rule overwrites the instance's rule. This happens whether the existing rule is enabled or disabled.
Single instance
-
Go to the Servers page in the Simple Application Server console.
-
Find the target Simple Application Server instance and click its instance ID on the instance card.
-
Click the Firewall tab.
-
In the upper-left corner of the Firewall page, click Apply Firewall Template.
-
In the Apply Firewall Template dialog box, select the firewall template and click Apply Template.
-
In the Apply Firewall Template dialog box, click View Execution Details.
The system automatically redirects you to the Template Utilization History tab on the Firewall Templates page.
Multiple instances
-
Go to the Firewall Templates page in the Simple Application Server console.
-
On the Firewall Templates tab, find the target firewall template and click Apply in the Actions column.
-
In the Apply dialog box, select the target Simple Application Server instances.
NoteYou can select up to 10 Simple Application Server instances at a time.
-
Click OK.
-
In the Apply dialog box, click View Execution Details.
You can also go to the Firewall Templates page and view detailed results on the Template Utilization History tab. For more information, see View firewall template application history.
View application history
You can view the application history of a firewall template even after the template is deleted.
-
Go to the Firewall Templates page in the Simple Application Server console.
-
On the Firewall Templates page, click the Template Utilization History tab.
-
In the list, view information such as the firewall template ID/name, applied instances, application task status, and creation time.
-
View detailed information about a template application.
-
In the Actions column for a record, click View Details.
-
In the Execution Details panel, view the results for each instance.
-
Delete a firewall template
Deleting a firewall template does not affect instances to which it has already been applied.
-
Go to the Firewall Templates page in the Simple Application Server console.
-
On the Firewall Templates tab, find the target firewall template and click Delete in the Actions column.
-
In the Delete dialog box, click OK.
References
To configure firewall rules directly on an individual instance, see Manage the firewall.