AWS EC2 Linux backup
AWS Amazon-EC2 cloudberrylab
Table of contents:
There is awesome Amazon Linux AMI, I think it is the most popular image that used for creating EC2 across all AWS regions. In fact you read / watch about it in every single tutorial / education course. I can just agree with all listed key features of it, but personally want to admit the following:
- Lightweight. Indeed, it’s super small and contains just really basic. In free tier it is supplied by GP2 8GiB (General Purpose SSD with up to 3000 IOPS) and for daily tasks that should be fine;
- Comes with built-in AWS CLI. This is what I really love! In few clicks with IAM role assigned ( (!!!) do NOT forget to do this launching your instance, otherwise you’ll miss that huge piece of Amazon);
- Stable and the most reliable. This might be just my opinion, but as it is driven by Amazon and community, it should be the most robust and mature.
The launch part should be super simple and in most cases people just follow the wizard (keep your pem key in the right place and chmod it to the lowest number you can). There are different use cases people have with this image (from hosting PBX to SQL / noSQL DBs or webservices with Apache / Nginx etc). It’s all about data actually and data should be saved and recoverable.
Cloudberry Backup for Linux and it comes with nice command line interface (CLI), what is really important (IMHO, in most cases admins run it without UI). Ok! The best way to get the software is to download it from CBL website and upload to one of bucket in your AWS S3 service (even through web interface, as it is just one file).
Amazon Linux is actually based on RHEL 5.x and 6 (partially). Go with Red Hat 6.x here.
Now, SSH to your Linux using the following:
ssh ec2-user@public_IP_of_linux_instance -i /path/to/your/pem-file
ec2-user - default user that should be used for remote SSH (you may want to reconfigure it once production), pem-file is the one you download when creating public key (don’t loose it and make sure
chmod 600 your.pem).
As you have AWS CLI built-in (check this nice video from re:Invent 2015) you actually can work with all AWS services. Let’s try it out and output something:
1aws s3 ls 22016-09-14 11:05:28 erudinsky-s3 32016-08-07 15:57:25 evgenyrudinsky 4aws s3 ls s3://erudinsky-s3 52016-09-14 11:05:49 45135196 rh6_CloudBerryLab_CloudBerryBackup_v220.127.116.11_20160810193949.rpm
Perfect! We can see objects in our buckets! And this is not all! We can also create, update and remove!
1aws s3 cp s3://erudinsky-s3/rh6_CloudBerryLab_CloudBerryBackup_v18.104.22.168_20160810193949.rpm /home/ec2-user/
We just copied rpm file (installed package of my CBL Backup for Linux) across to home directory of our default user! Let’s install this package quickly! It is very important to set this
--nodep flag, that will skip all required dependencies for graphic interface and add all CBL daemons accordingly.
1rpm -i rh6_CloudBerryLab_CloudBerryBackup_v22.214.171.124_20160810193949.rpm 2error: Failed dependencies: 3 libGL.so.1()(64bit) is needed
We just tried wrong way. Let’s add the flag! Install the software and activate license (BTW, there is totally FREE version available).
1rpm -i rh6_CloudBerryLab_CloudBerryBackup_v126.96.36.199_20160810193949.rpm --nodeps 2cbb activateLicense -e "email@example.com" -free -un yourname 3cbb activateLicense -e "firstname.lastname@example.org" -free -oa "received random key" 4CloudBerry Backup Command Line Interface started
We are done! Let’s configure accont (any from the list of 20+ providers, but let’s do this to S3 storage provide (Infrequent Accessed Data).
1cbb addAccount -d erudinsky-s3 -st AmazonS3 -ac <access_key> -sk <secret_key> -c erudinsky-s3 -ssl 2cbb account -l 3CloudBerry Backup Command Line Interface started 4erudinsky-s3 : AmazonS3 5cbb addBackupPlan -n "files" -a "erudinsky-s3" -f /home/ec2-user/files/" -c yes -notification on