Triage and Remediation
Remediation
Using Console
Using Console
To remediate the issue of Network Firewall Deletion Protection not being enabled for AWS EC2 using the AWS console, follow these step-by-step instructions:
- Login to AWS Console: Go to the AWS Management Console and login to your account.
- Navigate to EC2 Service: Click on the “Services” dropdown menu at the top left corner and select “EC2” under the Compute section.
- Select Security Groups: In the EC2 dashboard, click on the “Security Groups” option from the left-hand side menu.
- Select the Security Group: Identify the security group that you want to enable deletion protection for and click on it to select it.
- Enable Deletion Protection: In the security group details page, go to the “Actions” dropdown menu at the top and select “Edit inbound rules” or “Edit outbound rules” as per your requirement.
- Enable Deletion Protection: In the Edit rules page, scroll down to the bottom and locate the “Delete Protection” option. Check the box next to “Protect against accidental deletion” to enable deletion protection for the security group.
- Save Changes: After enabling deletion protection, click on the “Save rules” button to apply the changes.
Using CLI
Using CLI
To remediate the misconfiguration of Network Firewall Deletion Protection not being enabled for AWS EC2 instances using AWS CLI, you can follow these steps:By following these steps, you can remediate the misconfiguration of Network Firewall Deletion Protection not being enabled for AWS EC2 instances using AWS CLI.
- List all the security groups associated with your EC2 instances to identify the security group that needs to have deletion protection enabled:
- Enable deletion protection for the identified security group using the following command. Replace
<security-group-id>
with the actual Security Group ID:
- Verify that deletion protection has been enabled for the security group by describing the security group attributes:
Using Python
Using Python
To remediate the misconfiguration of Network Firewall Deletion Protection not being enabled for AWS EC2 instances using Python, you can use the Boto3 library, which is the AWS SDK for Python. Here are the step-by-step instructions to enable deletion protection for network firewalls associated with EC2 instances:
-
Install Boto3 library:
Ensure you have the Boto3 library installed. You can install it using pip:
-
Write a Python script to enable deletion protection for network firewalls:
Create a Python script (e.g.,
enable_firewall_deletion_protection.py
) with the following code: - Configure AWS credentials: Ensure that your AWS credentials are configured either through environment variables, AWS CLI configuration, or IAM roles.
-
Run the Python script:
Execute the Python script using the following command: