In this tutorial we are going to help you use the AWS Command Line Interface (CLI) to access Amazon S3. We will do this so you can easily build your own scripts for backing up your files to the cloud and easily retrieve them as needed. This will make automating your backup process faster, more reliable, and more programmatic. You can use this information to build a scheduled task (or cron job) to handle your backup operations.
Note: This tutorial builds upon the information from the Backing Up Your Files to Amazon S3 tutorial. If you haven't done that tutorial yet, you should complete that tutorial first.
Sign Up Now
Create a Free Accounta. Click here to open the AWS Identity and Access Management console. Click on Users on the left side.
Although creating login credentials isn’t required for the command line work in this tutorial, it is good security practice to never use your root account. Since we have set up this account as a full administrator of the AWS account, if you do select a password (and thus making the account able to log in) you can take the first step towards good security practices by starting to use this account instead of your root account. If you do not wish to set up a login password for this account you can skip to step 2.
j. Click the Download Credentials button and save the credentials.csv file in a safe location. Then click the Close link.
Note: Although the file you are downloading has the same name as the file you downloaded in step 1 part d, the files are different; this file contains the User Name and Password to log in to the AWS web console while the file in step 1 part d contains the Access Key Id and Secret Key used for the command line interface and for API-based access to AWS.
Now that you have your IAM user, you need to install the AWS Command Line Interface (CLI). Below are instructions based on the kind of operating system you are using; please select the tab that corresponds to your operating system.
Select PC from the tabs below if you are using a Windows-based computer.
Select Mac/Linux from the tabs below if you are using a machine running OSX or Linux.
a. Creating a bucket is optional if you already have a bucket created that you want to use. To create a new bucket named my-first-backup-bucket type aws s3 mb s3://my-first-backup-bucket
Note: bucket naming has some restrictions; one of those restrictions is that bucket names must be globally unique (e.g. two different AWS users can not have the same bucket name); because of this, if you try the command above you will get a BucketAlreadyExists error.
Congratulations! You have set up an IAM user, configured your machine for use with the AWS command line interface and you have learned how to create, copy, retrieve, and delete files from the cloud. In the next tutorial you’ll learn how to set up a virtual tape drive for use in backing up file from an existing backup program like Veeam, Symantec Backup Exec, Microsoft System Center 2012 Data Protection Manager, or other back up programs.
Learn how to create a Virtual Tape Library and use it with your existing backup software »