Total: £0.00

Manual Backups of Drupal files and database on Ubuntu 10.04 in Amazon EC2

By marksams, 06/07/2011 - 09:30


  • Ubuntu 10.04 server built on Amazon EC2
  • phpmyadmin installed and secured to only allow connections from as described here
  • SSH connection to your server

Backup the database

  • Open phpMyAdmin (using if you have the same setup as me)
  • Click on the 'Export' tab
  • Select the database to export
  • 'SQL' is the native format that allows easy restore back into MySQL/phpMyAdmin
  • Set options

    • Decide whether you want to drop database/tables etc in case of restore
    • Check 'Save as File'
    • Edit the file name template if you wish
    • Select compression - I use 'gzipped'
  • Click 'Go'
  • The database will be exported, compressed and presented as a file for download by your browser.

Backup web site files

Assuming you still have Putty open with an SSH connection to the server...

  • Type the following command to compress your web site files into an archive in the user home directory (/home/ubuntu by default)

    • 'tar -czpf ~/somefile.tar.gz /var/www/mywebsite'
    • Download the archive using filezilla...

      • Enter your server name ec2<...>com in the filezilla host box, prefixed with sftp://
      • Set the username to 'ubuntu'
      • Click Edit -> Settings ->Connection -> SFTP
      • Click 'add keyfile' and browse to your ppk file (without passphrase)
      • Click OK to close the dialogue box and then 'Quick Connect'
      • You can now copy the archive from the ubuntu user home directory to your local machine