Triage and Remediation
Remediation
Using Console
Using Console
To remediate the misconfiguration of not having a retention period set for the backup plan in AWS EC2 using the AWS console, follow these steps:
- Login to AWS Console: Go to the AWS Management Console (https://aws.amazon.com/console/) and login using your credentials.
- Navigate to AWS Backup Service: In the AWS Management Console, search for “Backup” in the services search bar and click on “Backup” under the “Storage” category.
- Select Backup Plans: In the AWS Backup console, click on “Backup plans” in the left-hand navigation pane.
- Edit Backup Plan: Find the backup plan that needs to have a retention period set and click on the plan name to select it.
- Add Retention Period: In the details of the backup plan, locate the section where you can set the retention period. Click on the “Edit” button next to the retention settings.
- Set Retention Period: Enter the desired retention period in days for the backups to be retained. This can vary depending on your organization’s retention policies.
- Save Changes: After setting the retention period, click on the “Save” or “Update” button to save the changes to the backup plan.
- Verify Configuration: Double-check the backup plan details to ensure that the retention period has been successfully set.
Using CLI
Using CLI
To remediate the misconfiguration of not having a retention period set for the backup plan in AWS EC2 using AWS CLI, follow these steps:
-
List Backup Plans: First, list all the existing backup plans to identify the one that needs to be updated. You can use the following AWS CLI command:
-
Update Backup Plan: Once you have identified the backup plan that needs to be updated, you can use the following AWS CLI command to update the backup plan with a retention period:
Replace
<backup-plan-id>
with the ID of the backup plan that needs to be updated and<retention-period>
with the number of days you want to retain the backups. -
Verify: Finally, verify that the retention period has been set successfully by listing the details of the updated backup plan using the following AWS CLI command:
This command will display the details of the backup plan, including the retention period for EC2 resources.
Using Python
Using Python
To remediate the misconfiguration of not having a retention period set for the backup plan in AWS EC2 using Python, you can follow these steps:
-
Install the AWS SDK for Python (Boto3) if you haven’t already. You can install it using pip:
- Write a Python script to update the backup plan with the desired retention period. Here is an example script to set a retention period of 30 days for a backup plan in AWS EC2:
-
Replace
'your_backup_plan_id_here'
with the actual Backup Plan Id that you want to update. -
Replace
'YourBackupPlanName'
with the name of your backup plan. - Run the Python script to update the backup plan with the specified retention period.