Understanding EBS Recycle Bin and Retention Rules
The EBS Recyle Bin is a service used for protecting EBS Snapshots and Amazon Machine Images [AMI]s from accidental deletion. The idea is that as the user creates a large amount of volumes, snapshots, and is managing those actions programmatically, it’s possible to inadvertently delete a volume that wasn’t meant to be deleted. The EBS Recyle Bin allows the user to specify a set of rules called “Retention Rules” which as the name suggests will store the deleted item for a certain period of time.
In this tutorial, our goal is to create a set of retention rules via the EBS Recycle Bin and test that they’ve been properly deployed by deleting an EBS Volume we’ve provisioned in a different tutorial.
To follow along with this tutorial, you will need:
Accessing the EBS Recycle Bin Service
The EBS Recycle Bin service isn’t obvious to locate. You’ll need to navigate to the snapshots tab of the EC2 Dashboard to locate it.
Step 1 - Navigate to the Snapshots Service and Recycle Bin
1.1 - From the EC2 Dashboard, click on “Snapshots.”
1.2 - From the top right menu, click on “Recycle Bin.”
Creating a Retention Rule via EBS Recycle Bin
Step 1 - Creating a New Retention Rule
1.1 - From the Recycle Bin Service, click on “Create retention rule.”
Step 2 - Parameters of the Retention Rule (Part 1 / 2)
You can create multiple retention rules based on Snapshots vs AMI, the tags assigned to them, etc. In other words, you may choose to “protect” certain EBS Snapshots for a longer duration than others.
2.1 - From the Rule details, specify an optional name for the rule.
2.2 - From the Rule details, specify an optional description for the rule.
2.3 - From the Retention settings, select the resource type.
Note: The resource type can be an EBS Snapshot or an AMI. For the purpose of this tutorial, we’re going to create a rule for an EBS Snapshot.
Note 2: We’ve selected “Apply to all resources” which means that we’re not going to specify the tags of the resources; choose according to your application / organization.
Step 3 - Parameters of the Retention Rule (Part 2 / 2)
One of the key parameters of the retention rule is how long the asset will be retained (in days). It’s important to note, in case you’ve missed the warning prior to rule creation, that a saved Snapshot or AMI is going to be billed for the retention period. In other words, if you’re not going to come back to the Recyle Bin and review what has been deleted over 3 months ago, there’s no point in paying for those backups. Select a timeframe that is reasonable for your application / organization.
3.1 - From the Rule details, specify an optional name for the rule.
3.2 - From the Rule details, specify an optional description for the rule.
Conclusion on EBS Recycle Bin & Retention Rules
We’ve successfully created a retention rule from within the Recycle Bin service in AWS. Once you’ve completed the steps above, your new rule should be available via the main dashboard of the Recycle Bin. At this point, you can modify the parameters of the rule as needed.