Expert Guide: How-to Automate an EBS Volume Snapshot

Expert Guide: How-to Automate an EBS Volume Snapshot

We use EBS volumes for persistent storage. To ensure we do not lose data and take backup regularly, AWS provides mechanism to take snapshot. Learn more on how to snapshot an EBS volume. In this guide, we will show, how to automate snapshots for an AWS EBS volume by schedule an automatic cron job. We will use Linux instance and see how to automate the snapshot using cronjobs.

After tracking the usage patterns of hundreds of Amazon AWS customers, Newvem identified that more than 35% if its beta users are operating an Amazon AWS cloud that is highly vulnerable to outages. Additionally, we found that 40% of AWS users Cloud data, applications and infrastructure are not backed up. It is crucial to protect yourself from AWS Cloud outages and one way to do this is with Elastic Block Storage (EBS) volumes.

Prevent Damage from AWS Cloud Outages

Newvem’s Cloud Care service will scan your AWS footprint and detect how prepared you are for the next AWS outage and let you know:

  • Which EBS volumes are not backed up
  • Which EBS volumes are stale and need to be refreshed

In the case that an outage damages an EBS volume, a user can recreate the volume from a snapshot, in the same state as the time of the snapshot. If the availability zone where the EBS was active remains down for a long time, the user can provision an EBS volume from a snapshot in another availability zone.  Volumes are tied to availability zones but snapshots are tied only to the region. In case your volumes are unavailable in one availability zone, you can restore the last saved snapshot onto another availability zone.

Newvem actively prioritizes significant risk to cloud health based on its severity, including security and availability. Get started with Newvem’s AWS cloud care:

So now that we understand the importance of EBS volume snapshots, how can we best integrate them into our current processes?

How-to Automate an EBS Volume Snapshot

1.  Login to your AWS Linux instance as described on ‘How-to connect to AWS Linux instance from Windows Machine‘.

2.  Run the command `set`.

3.  `Set` will list all the environment variables set of the instance.

4.  Note down the path of EC2_HOME, JAVA_HOME, EC2_AMITOOL_HOME (indicated in the screenshot above).

5.  EC2 API tools should be installed on your AWS instance. If not installed, download them from Unzip and store the EC2 API tools files in the new folder  /opt/aws/amitools/ec2  (the EC2_HOME directory). Note that in general All AWS instances have these tools pre-installed.

6.  Copy your x.509 certificates (cert & pk) files into the AWS instance. You can use scp command (Linux desktop) or WinSCP (Windows Desktop application) to upload the files from your local desktop to the AWS instance machine.

7.  Validate that the certificate and pk were copied to the target directory.

8.  Run ec2-create-snapshot command to validate that the command line tool (CLI) is working properly.

9.  You need to set the uploaded CERT & PK in environment. “Completed”, means that  the snapshot was created successfully.

10.  Make a shell file for the snapshot execution.

<Page 1>

Pages: 1 2

You must be to post a comment.

* As a bonus, you'll receive our weekly newsletter!

Hitchhiker's Guide to The Cloud

Newvem's eBook for Cloud Operations