All Products
Search
Document Center

Elastic Compute Service:Export and import security group rules

Last Updated:May 14, 2024

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

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Network & Security > Security Groups.

  3. In the top navigation bar, select the region and resource group to which the resource belongs. 地域

  4. 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.

  5. In the Access Rule section, import or export security group rules.

    Export security group rules

    Note

    You 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 is cn-qingdao and groupID is sg-123, the name of the exported JSON file is ecs_cn-qingdao_sg-123.json.

    • CSV Format

      The exported CSV file complies the following naming convention: ecs_sgRule_${groupID}_${regionID}_${time}.csv.

      If regionID is cn-qingdao, groupID is sg-123, and time is 2020-01-20, the name of the exported CSV file is ecs_sgRule_sg-123_cn-qingdao_2020-01-20.csv.

    Import security group rules

    Note

    To 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.

    1. Click 导入.

    2. 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.

        Note

        If a security group rule fails the import check, you can move the pointer over the Warning icon to view the details of the failure.

    3. Click Start.