You can export and import security group rules in the Elastic Compute Service (ECS) console in scenarios such as the backup, restoration, and migration of security group rules. This topic describes how to export and import security group rules in the ECS console.
Considerations
We recommend that you modify the exported security group rule files based on your business requirements and then import security group rules from the modified files to security groups.
You can import security group rules across regions. However, you cannot import the security group rules that reference security groups or prefix lists as authorization objects (destinations or sources) across regions.
Procedure
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
On the Security Groups page, find the security group from which you want to export security group rules. In the Actions column, click Manage Rules.
In the Access Rule section, import or export security group rules.
Export security group rules
NoteYou can export security group rules as JSON or CSV files in the ECS console to your computer for backup.
Click and select a file format to export the security group rules as a file in the selected format to your computer.
JSON Format
The exported JSON file complies with the following naming convention:
ecs_${regionID}_${groupID}.json
.If
regionID
iscn-qingdao
andgroupID
issg-123
, the name of the exported JSON file isecs_cn-qingdao_sg-123.json
.CSV Format
The exported CSV file complies the following naming convention:
ecs_sgRule_${groupID}_${regionID}_${time}.csv
.If
regionID
iscn-qingdao
,groupID
issg-123
, andtime
is2020-01-20
, the name of the exported CSV file isecs_sgRule_sg-123_cn-qingdao_2020-01-20.csv
.
Import security group rules
NoteTo ensure that security group rule can be imported, we recommend that you import up to 200 security group rules at a time to a security group. The imported security group rules do not overwrite the existing rules. For more information, see the Security group limits section in the "Limits" topic.
Click .
In the Import Security Group Rule dialog box, click Select a file and then select the JSON or CSV file that you want to import.
The dialog box displays the following information for your preview:
Details of the rules.
Results of the import check.
NoteIf a security group rule fails the import check, you can move the pointer over the Warning icon to view the details of the failure.
Click Start.