Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance. This means customers of all sizes and industries can use it to store and protect any amount of data for a range of use cases, such as websites, mobile applications, backup and restore, archive, enterprise applications, IoT devices, and big data analytics. Amazon S3 provides easy-to-use management features so you can organize your data and configure finely-tuned access controls to meet your specific business, organizational, and compliance requirements. Amazon S3 is designed for 99.999999999% (11 9’s) of durability, and stores data for millions of applications for companies all around the world.
Short Introduction of Amazon S3. Click on this Link to read more.
- Create AWS user account:
AWS user account Access Key and Secret access key will be responsible for providing S3 bucket access through s3cmd plugin inside Linux machine. All you need to do now is to create a user and add it to the group you created. For that Go to Services of AWS select IAM. Select Users from the panel on the left, and click Add User. Choose any username you like(In below reference screenshot I am creating s3_linux_user), under access type make sure Programmatic Access and Allow Management Console Access is selected and click Next: Permissions. On the next page select the group you created and click on Next: Review. AWS will confirm that you’re adding this user to the selected group and confirm the permissions being granted. Click on Create User to move on to the next page. You’ll now see an Access key ID and a Secret access key. These are self-generated and only displayed once. You can either copy and paste them to a secure location, or click Download .csv which will download a spreadsheet containing these details. This is the equivalent of the username and password that your computer will be using to access S3.
Below are the reference screenshots for these steps:
- Create S3 Linux machine backup bucket.
For creating Amazon S3 bucket go to Services > Storage > S3. Click on Create bucket button. Chose a globally unique name (lowercase only), pick a region that you would like your bucket to live in. Clicking the Create button will create your Linux machine backup S3 bucket.
- Install the python-setuptools before installing s3cmd plugin.
Execute below command for installing python-setuptools:
sudo apt install python-setuptools
- Unzip the downloaded s3cmd zip file in your desire directory.
- Go inside the unzipped s3cmd plugin files and execute the below command for installing the s3cmd plugin:
sudo python setup.py install
- Post installation now it is time to configure s3cmd plugin so that you can get access of your S3 bucket in Linux machine. Run the below command for doing configuration:
- Above command will prompt to enter a few details. First of all it will prompt to enter your Access key ID followed by your Secret access key (these details can be available in user detail under IAM service in AWS console). Leave the rest settings as default by just hitting the enter key, except the Encryption setting. Here you need to put password so that data sent in and out of S3 in encrypted form. Encryption of data transmission is necessary for preventing Man in Middle attack.
- Post configuration it will prompt you to test the connection with AWS S3.
- You can also test by listing s3 bucket with below command post configuration:
Testing Linux machine backup to S3 bucket
- Now it is time to test Linux machine backup to S3 bucket. In below demonstration I have created two test files which I have taken backup to my S3 bucket. I have used below s3cmd sync command for syncing Backup to my S3 bucket:
- Same synced backup files you can see in my AWS S3 console as well:
To restore lost data in Linux machine from S3 Bucket
In case of data loss in your Linux machine you can use same s3cmd sync command for restoring lost data from Amazon S3 storage bucket. In this below demonstration you can see with the help of same s3cmd sync command I have restored the accidentally removed data in my Linux machine from my S3 backup bucket:
In my this blog you have seen Amazon S3 can be prove very cost effective and robust Backup storage in AWS Cloud. You can use Amazon S3 as a Backup storage for your Linux machines infrastructure which are available in your premises.
Good to read more about Amazon S3: