Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EBS snapshots vs. WAL-E for PostgreSQL on EC2

I'm getting ready to move our posgresql databases to EC2 but I'm a little unclear on the best backup and recovery strategy. The original plan was to build an EBS backed server, set up WAL-E to handle WAL archiving and base backups to S3. I would take snapshots of the final production server volume to be used if the instance crashed. I also see that many people perform frequent snapshots of the EBS for recovery purposes.

What is the recommended strategy? Is there a reason to archive with WAL and perform scheduled EBS snapshots?

like image 747
user2352879 Avatar asked Jun 14 '13 01:06

user2352879


People also ask

Are snapshots cheaper than EBS volumes?

Snapshots are a cheaper option than EBS volumes. Efficient management of EBS volumes with wise use of snapshots can be the key to keeping your storage costs under budget.

What is the difference between backup and snapshot AWS?

An AWS snapshot is just a point-in-time copy of an Amazon EBS volume with limited storage and recovery options. A backup is a more comprehensive and flexible copy of your VMs that offers reliable protection and ensures fast and consistent recovery.

What is the purpose of creating snapshots in EBS?

Snapshots can be used to create a backup of critical workloads, such as a large database or a file system that spans across multiple EBS volumes. Multi-volume snapshots allow you to take exact point-in-time, data coordinated, and crash-consistent snapshots across multiple EBS volumes attached to an EC2 instance.

What is a PostgreSQL snapshot?

This is a physical backup utility included with the standard PostgreSQL installer. Data is copied from the data directory and any tablespaces to an intended target location in a filesystem. Storage snapshots. Storage snapshots capture the state of a database's storage at a point in time.


1 Answers

The EBS Snapshots will give you a slightly different type of backup than then WAL-E backups. EBS backups the entire drives, which means if your EC2 Virt goes down you can just restart the virt with your last EBS snapshot and things will pickup right where you last snapshotted things.

The frequency of your EBS snapshots would define how good your database backups are.

The appealing thing about WAL-E is the "continuous archiving". If I needed every DB transaction backed up, then WAL-E seems the right choice. Manys apps I can envision cannot afford to lose transactions, so that seems a very prudent choice.

I think your plan to snapshot the production volumes as a baseline, then use WAL-E to continuously archive the database seems very reasonable. Personally I would likely add a periodic snapshot (once a day?) to that plan just to take a hard baseline and make your recovery process a bit easier.

The usual caveat of "Test your recovery plans!" applies here. You're mixing a number of technologies (EC2, EBS, Postgres, Snapshots, S3, WAL-E) so making sure you can actually recover - rather than just back - is of critical importance.

like image 113
Chris M. Avatar answered Sep 29 '22 08:09

Chris M.