AWS EBS Snapshots & Recycle Bin

cem akpolat
5 min readSep 25, 2022

AWS includes really nice features, and it becomes very difficult at some point to remember all of them. Therefore, I find my self sometimes while looking for the same things that I have seen many times, I believe you have also similar experiences. Today’s topic is actually pretty simple and can be required sometimes in case you have real concerns about the persistence of your data saved in Elastic Block Storage(EBS), which is attached to your EC2.

As you know, an EBS volume snapshot can be utilized for many purposes, such as copying a volume from an AZ zone to another one to protect your data, or you may use it as it is, or you may just store it with the aim of recovering your volume from the latest snapshot. In other words, snapshots can save your time for many things.

If you believe, you need EBS snapshots and your purpose if EBS snapshot is removed for some reason, it should be recovered from the snapshot that is saved before, then we can follow the following steps to make it possible. These steps are:

  • Create EC2 considering AWS Free tier
  • Perform the recovery steps for a snapshot
  • Observe recovering process after EBS snapshot deletion.

Create EC2 Instance

Assuming that you're logged in AWS and type EC2 in the search field of the AWS, and click the Instances on the left panel, and then click Launch Instances as depicted in the figure below.

The plan is to keep the configuration as simple as possible, for this reason, just give the name of the ec2 instance, ec2-tutorial and generate a key pair

The rest configuration is related to the selection of

  • Amazon machine image, in oder words OS: currently amazon linux 2
  • instance type: t2.micro, this signifies the required resources for your environment. 1 CPU and 1 GB RAM are enough
  • key pair (login): If you want to log in using a .pem file in linux, you can use the file to be generated from this section via ssh -i ec2-tutorial.pem hostname@ipadress . This will redirect you to the terminal screen of your virtual machine.
  • Network settings: default. Any security groups, a restriction for the incoming and outgoing traffic into/from ec2 image can be adjusted here.
  • Configure storage: EBS volume that will be attached to the EC2 image when OS is started.
  • Advanced configs: This is a detailed configuration how your EC2 OS will behave, we skip this one.

Once we are done and if you do not change the configs, we can click Launch Instance.

Now our instance is running after waiting couple of seconds:

Creating a snapshot from a single EC2 Volume

Clicking the Create snapshot is pretty easy and you should select the volumes on the left panel and one volume should be created for your EC2 image. From this EBS volume, we can create the snapshot as shown below:

Initiating Recycle Bin

Our intention is to recover our EBS, when it is deleted. In case we click the Recycle Bin button on the selected snapshot, it will navigate us to the following page, in which we will press Create retention rule button.

First, the retention rule name and descriptions are required.

Retention settings enable us to define the resource type, whether it is an image or EBS snapshot, resource tags to match, whether we target a specific group of resource types, and finally retention period, which informs us about the recovery time after the deletion.

In our example, we clicked Apply to all resources to simplify the process.

Recovering Deleted Snapshot

Below we delete the snapshot, and it will not be listed any more under Snapshots list. However, we noticed that we did a mistake, therefore we navigate us to the Recycle Bin.

Under Resources in Recycle Bin, we can recover from the deleted EBS volume as illustrated below:

We can even create an EBS volume from this snapshot in any AZ region depicted in the following figure.

Summary

Taking volume or image snapshots can be life- and time-saving operations, since recovering a snapshot can be effortlessly performed as you experienced throughout this tutorial. The same approach can also be applied to Amazon Machine Image, the focus will be in this case an OS image.

--

--