Cloud News‎ > ‎

Data safety with EBS using Snapshots - Backup/Recovery

posted Nov 11, 2016, 1:16 AM by Rick Hightower   [ updated Nov 11, 2016, 10:04 AM ]

Data safety with EBS - Backup/Recovery (Snapshots)

Amazon EBS allows you to easily backup data. You do this by taking snapshots. Snapshots are point-in-time backups. Data written to an EBS volume can be periodically used to create a snapshot. Snapshots provide incremental backups of your data. Snapshots just saves the blocks that have changed. Only changed blocks since the last snapshot are saved in the new snapshot.

Even though snapshots are saved incrementally, only the last snapshot is needed in order to restore the volume. You can delete older snapshot, and still use the latest snapshot.

Taking Snapshots

Snapshots are done with:

  • AWS Management Console
  • Scheduled snapshots
  • AWS API
  • AWS CLI

EBS snapshots are backed by S3 in AWS-controlled storage. You can see these snapshots your account’s Amazon S3 buckets. It is hidden from you but backed by S3. You use the snapshot tools to manage snapshots not S3.

Snapshots are stored per region. You use snapshots to create new EBS volumes. Snapshots can be copied to other regions.

Using snapshots

Snapshots are used to create new EBS volumes. The volume is created and the data is transferred lazily into the EBS volume. Data accessed before the transfer is restored on request. If you need to increase the size of a volume, you create a snapshot and then recreate a larger volume from the snapshot. Then replace the original volume with the new volume from the snapshot.

Tag snapshots to help manage them later. Describing the original volume of the snapshot with the device name (/dev/sdd).

The AWS console can be used to take snapshots or the command line.

Using command line to create a snapshot of a volume

aws ec2 create-snapshot --volume-id vol-1234567890abcdef0 --description "Hadoop RAID 0 volume 5."

Restoring volumes from snapshots

Amazon EBS volumes persist beyond the EC2 instance lifecycle. Thus you can recover data of an instance that fails. Before the instance is terminated, the volume should be detached. Then the volume can attached as a data volume to another instance and then the data can be recovered.

Backing up root devices

To create a snapshot from a root devices EBS volume, should unmount the volume before taking the snapshot so the OS or application that have outstanding / cached blocks can flush them.

To unmount the volume in Linux, use the following command:

umount -d /dev/sdc

Best practices for Backup and Recovery

There are best practices for dealing with EBS. Back up your EC2 instance regularly using Amazon EBS snapshots. Test the process of recovering your instances from snapshots if the Amazon EBS volumes fail. Use separate volumes for the operating system versus your data. Make sure that the data persists after instance termination. Don't use instance store for database storage, unless you are using replication.

Comments