Backup process of EC2 instance

Make a backup snapshot using the AWS console (This is a manual process for taking one snapshot)

This is a simple backup procedure for taking one snapshot and storing it in EBS (Elastic Block Store). A snapshot is a copy of a disk volume. A snapshot is not a complete copy – it is only the bits that have changed since the last snapshot.

First find the name of the volume to back up.

  1. Open the AWS console. (
  2. Navigate to the list of EC2 instances.  The breadcrumbs to follow are EC2   tab > INSTANCES > Instances.
  3. Display the root device name of the instance  to back up. Tick the row in the top pane, click the sda1  link in the bottom pane and a popup box appears with the volume’s EBS ID name, along the lines  of vol-12345678. Note down the EBS ID.
  4. Now make a snapshot.
  5. Open the snapshot dialog box. ELASTIC BLOCK STORE | Snapshots | Create  Snapshot button in the top pane.
  6. Fill in the form. Entered the name as  Restore WordPress Prod.
  7. Click the Create button. The AWS apps behind the scenes create the backup in a couple minutes.

Restore process of EC2 insatnce

Restore a backup snapshot by mounting on an existing EC2 machine

Make a volume from the snapshot to mount the volume on an existing EC2 machine and copy files from it. You can’t mount a volume from one zone on a machine in another zone.

Check the EC2 instance:

  1. Pick an instance. EC2 tab |  INSTANCES | Instances.
  2. Make a note of the EC2 instance availability zone.

Create a volume:

  1. Find the snapshot you want to copy files from and tick the box. ELASTIC BLOCK STORE | Snapshots
  2. Click the Create Volume button and  fill in the fields.
    • The Size must be bigger than the  snapshot size (free micro-instances get an 8GB volume).
    • The Availability Zone must be the  same as the EC2 insatnce.
    • The Snapshot is already selected,  more or less like snap12345678      
  3. Click the Yes, Create button. A new line appears in the Volumes table. ELASTIC BLOCK STORE | Volumes

Attach the volume:

  1. Click the Attach Volume button and  fill in the fields.
  2. The Volume value is already there.
  3. Pick your insatnce name i-12345678 (running) from the  drop-down list of Instances.
  4. The Devices field shows the first available device name, like /dev/sdf.
  5. Click the Yes, Create button. A new  device magically appears on the EC2 machine.
  6. Close the AWS console.

Copy files:

  1. Open the putty and connect to the server.
  2. Mount the new volume.
    sudo mount /dev/sdf /mnt/
  3. Copy any files you want to the old  volume.
    cp /mnt/home/ec2-user/var/www/home/ec2-user/var/www

Clean up:

  1. Unmount the new volume.
    sudo umount /mnt/
  2. Close the putty.


Leave a comment

Your email address will not be published. Required fields are marked *