Web Niraj
  • Facebook
  • Flickr
  • Github
  • Linkedin
  • Twitter
  • YouTube
Online portfolio, code examples and developer blog
  • About
  • Contact
  • Portfolio
  • WordPress
Search the site...
  • Home
  • Blog
  • Using Amazon S3 to Backup Your Server

Using Amazon S3 to Backup Your Server

7

Amazon S3 provides a cheap solution and easy to use solution to back up your Linux server or files on the cloud. The Linux s3cmd script lets you use rsync to backup folders and files easily, and you can even choose to just backup files that have changed since the last backup.

You need to start by installing s3cmd on your server. You can do this using apt-get (Ubuntu) or yum (Fedora or CentOS):

AWS Security Credentials

Find your AWS Security Credentials

Next, you need to configure the application to use your AWS credentials. You can find your “Security Credentials” from the “My Account / Console” menu from the AWS site. Then, you need to run the s3cmd --configure command. You’ll be asked to enter your AWS Access and Secret keys so the script can access your S3 buckets.

Once configured, the script will verify your settings to confirm it can connect to your AWS account to access your S3 buckets. You can then list the buckets on your account by entering the command: s3cmd ls

s3cmd --configure

You can then use the s3cmd sync to rsync files to your server. On my server, I use the following two commands to run the script from terminal or via a scheduled cron job:

The above commands will log the results of the transfer to the s3_backup.log file. Looking at the last line of the file will reveal how many files were transferred, how long the transfer took and the size of the transfer:

s3cmd log

Amazon Web Services, Backup, Linux, Security

7 comments on “Using Amazon S3 to Backup Your Server”

  1. huckfinnca says:
    April 9, 2013 at 5:32 PM

    Thank you Niraj. Nice precise information on howto set-up Amazon S3 as your back-up server using Linux. Within a couple of minutes and your information my Debian Linux was backing up!

    Reply
  2. David Brough says:
    April 18, 2013 at 6:58 PM

    Thanks for the short and sweet of it. Very useful information, I am looking into serving all my images and static files through CloudFront and this may come in handy.

    Reply
  3. Fred says:
    May 20, 2013 at 8:45 PM

    Thank you very much! Very easy to set up and it works great. I’m doing this rather than use a pricey cloud backup service.

    Reply
  4. Dave Beck says:
    June 8, 2013 at 5:27 AM

    Dynamite tutorial, Niraj. With the addition of a small shell script, I’m now backing up key files on client sites, automatically and only when needed. Thanks much!

    Reply
  5. Backup your EC2 Amazon Linux Wordpress Blog to S3 | Packet Lost says:
    January 25, 2015 at 7:07 AM

    […] First off, thanks to this helpful blog post for guidance. […]

    Reply
  6. Satsen Singh says:
    February 11, 2016 at 5:27 AM

    Thank you so much Niraj 🙂 Please give me your mail Id so I can ask you any doubt in future.

    Reply
    • Niraj Shah says:
      February 14, 2016 at 5:31 PM

      Use the contact form on my site to get in touch.

      Reply

Leave a Reply to Backup your EC2 Amazon Linux Wordpress Blog to S3 | Packet LostCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

StackExchange / StackOverflow

profile for Niraj Shah on Stack Exchange, a network of free, community-driven Q&A sites

Support Me

Buy Me a Coffee

PSN Profile

Tags

ACL Amazon Amazon Web Services Android Android 4.4 KitKat Android 5.0 Lollipop Apache Backup Bug Command Line Cordova cPanel / WHM Facebook Facebook Graph API Facebook PHP SDK 4.0 Facebook Social Plugins Fan Page Firewall Flash Gadget Geolocation Google Nexus 5 Hacking HTML5 iOS JavaScript jQuery Laravel 5 Linux NodeJS Parse PDF PHP Plugin Portfolio PS4 Review Security Server SSH SSL Sysadmin Tutorial WordPress WordPress Plugins
© 2011-2025 Niraj Shah
  • Blog
  • Portfolio
  • WordPress
  • About Me
  • Contact Me
  • Privacy Policy
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Privacy Policy