You are on page 1of 9

Module 7: Data management ­ Backup, DR, 

Test/Dev environments 
 
Introduction 
EBS Snapshots (CLI) 
AMIs (CLI/Console) 
RDS Automated backups (Console) 
RDS read replicas (Console) 
RDS manual snapshots (CLI/Console) 
S3 backups (CLI/Console) 
Amazon Glacier (CLI) 
Review/Assignments 
 

Introduction 
Amazon Glacier 
https://aws.amazon.com/glacier/ 
 
EBS snapshots 
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSSnapshots.html 
 
RDS backing up and restoring 
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_CommonTasks.BackupRestore.html 
 
RDS read replicas 
https://aws.amazon.com/rds/details/read­replicas/ 
 
S3 object life cycle management 
http://docs.aws.amazon.com/AmazonS3/latest/dev/object­lifecycle­mgmt.html 
 
Cross region copy/replication 
https://aws.amazon.com/blogs/aws/new­cross­region­replication­for­amazon­s3/ 
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs­copy­snapshot.html 
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html 
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CopySnapshot.html 
 
Sharing AMIs/Snapshots 
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sharingamis­explicit.html 
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs­modifying­snapshot­permissions.html 
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ShareSnapshot.html 
 
CLI References 
http://docs.aws.amazon.com/cli/latest/reference/glacier/index.html 
EBS Snapshots (CLI) 
Create snapshots 
aws ec2 create­snapshot ­­volume­id vol­1509ade2 ­­description "app­snapshot­11122015" ­­dry­run  
aws ec2 create­snapshot ­­volume­id vol­1509ade2 ­­description "app­snapshot­11122015" 
aws ec2 describe­snapshots ­­snapshot­id snap­5178250e 
 
Create snapshots (after stopping instances) 
aws ec2 describe­instances ­­instance­ids i­31745bf5 
aws ec2 stop­instances ­­instance­ids i­31745bf5 
aws ec2 start­instances ­­instance­ids i­31745bf5 
aws ec2 describe­snapshots ­­owner­ids 560125328540 
aws ec2 describe­instances ­­instance­ids i­31745bf5 
 
Copy snapshots (cross­region) 
aws ­­region us­east­1 ec2 copy­snapshot ­­source­region us­west­2 ­­source­snapshot snap­5178250e 
­­description "app­snapshot­dr­11122015" 
aws ­­region us­east­1 ec2 describe­snapshots ­­snapshot­ids snap­40cc6bd6 
aws ­­region us­east­1 ec2 describe­snapshots ­­owner­ids 560125328540 
 
Restore: Create volume from snapshot + attach to an EC2 instance 
aws ec2 create­volume ­­snapshot­id snap­5178250e ­­availability­zone us­west­2a 
aws ec2 describe­volume­status ­­volume­id vol­8e06384f 
aws ec2 describe­volumes ­­volume­id vol­8e06384f 
aws ec2 attach­volume ­­volume­id vol­8e06384f ­­instance­id i­31745bf5 ­­device /dev/sdf 
 
Cleanup 
aws ­­region us­east­1 ec2 describe­snapshots ­­owner­ids 560125328540 
aws ­­region us­east­1 ec2 delete­snapshot ­­snapshot­id snap­40cc6bd6 
 
aws ­­region us­west­2 ec2 describe­snapshots ­­owner­ids 560125328540 
aws ec2 delete­snapshot ­­snapshot­id snap­5178250e 
 
aws ec2 describe­volumes 
aws ec2 delete­volume ­­volume­id vol­8e06384f 
 
aws ec2 describe­instances 
aws ec2 terminate­instances ­­instance­id i­31745bf5 
 
Web console 
Share Snapshot with test/devel account 
 
 
 
AMIs (CLI/Console) 
Create AMI 
aws ec2 create­image ­­instance­id i­50012e94 ­­name appami ­­reboot 
 
Cross AMI (cross region) 
aws ec2 copy­image ­­source­image­id ami­4d233f2c ­­source­region us­west­2 ­­region us­east­1 ­­name 
"appami­dr" 
 
View/Verify 
aws ec2 describe­images ­­owners 560125328540 
aws ec2 ­­region us­east­1 describe­images ­­owners 560125328540 
 
Restore/launch 
aws ec2 run­instances ­­image­id ami­4d233f2c ­­count 1 ­­instance­type t2.micro ­­key­name edureka­1 
­­security­groups default 
 
Web console 
Share AMI with test/devel account 
 
 
 
 
   
RDS Automated backups (Console) 
Key points: 
● Restore to point in time 
● Max 35 days retention 
● Deleted if retention changed to 0 
● Deleted if instance is terminated 
● IO Freeze during backup 
● Multi­AZ I/O freeze is for shorter period 
● Change to retention period is immediate (outage due to backup/reboot) 
 
Demo: 
● Modify retention period 
● Point in time recovery 
 
 
   
RDS read replicas (Console) 
Demo: 
● Create read replica in another region 
● Promote read replica to replace primary   
RDS manual snapshots (CLI/Console) 
 
Create snapshot 
aws rds create­db­snapshot ­­db­instance­identifier edureka ­­db­snapshot­identifier dbsnap11122015 
aws rds describe­db­snapshots ­­db­snapshot­identifier dbsnap11122015 
 
Web Console 
Sharing snapshots 
Copying snapshots 
 
Copy snapshot (cross region) 
aws rds copy­db­snapshot ­­source­db­snapshot­identifier 
arn:aws:rds:us­west­2:560125328540:snapshot:dbsnap11122015 ­­region us­east­1 
­­target­db­snapshot­identifier dbsnap11122015­dr 
aws ­­region us­east­1 rds describe­db­snapshots ­­db­snapshot­identifier dbsnap11122015­dr 
 
Restore 
aws rds restore­db­instance­from­db­snapshot ­­db­instance­identifier edureka­2 ­­db­snapshot­identifier 
dbsnap11122015 
aws rds describe­db­instances ­­db­instance­identifier edureka­2 
aws rds modify­db­instance ­­db­instance­identifier edureka­2 ­­db­security­groups sg­530d3b37 
Note: create vpc security group 
 
Copy snapshot (from automated snapshot) 
aws rds describe­db­snapshots ­­snapshot­type automated 
aws rds copy­db­snapshot ­­source­db­snapshot­identifier rds:edureka­2015­12­11­14­49 
­­target­db­snapshot­identifier dbcopy­edureka­20151211 
aws rds describe­db­snapshots ­­db­snapshot­identifier dbcopy­edureka­20151211 
 
Cleanup 
aws rds describe­db­snapshots 
aws ­­region us­east­1 rds describe­db­snapshot 
aws rds delete­db­snapshot ­­db­snapshot­identifier dbcopy­edureka­20151211 
aws ­­region us­east­1 rds delete­db­snapshot ­­db­snapshot­identifier dbsnap­copy 
aws rds delete­db­snapshot ­­db­snapshot­identifier dbsnap 
aws rds delete­db­snapshot ­­db­snapshot­identifier rds:edureka­2015­12­11­14­49 
Note: automated cannot be deleted 
 

   
S3 backups (CLI/Console) 
Web Console 
● Create bucket for backup 
● Setup cross­region replication 
● Setup object life­cycle policies 
 
Move archive to S3 bucket 
aws s3 mv backup.zip s3://edureka­backup/backup.zip 
aws s3 ls s3://edureka­backup 
 
Restore: Download backup file 
aws s3 mv s3://edureka­backup/backup.zip . 
ls backup.zip 
aws s3 ls s3://edureka­backup 
 
 
   
Amazon Glacier (CLI) 
 
Create archive vault 
aws glacier create­vault ­­vault­name edureka ­­account­id ­ 
 
Upload archive 
aws glacier upload­archive ­­vault­name edureka ­­account­id ­ ­­body backup.zip 
 
List archives 
aws glacier describe­vault ­­vault­name edureka ­­account­id ­ 
 
Initiate inventory retrieval job 
aws glacier initiate­job ­­account­id ­ ­­vault­name edureka ­­job­parameters '{"Type": "inventory­retrieval"}' 
NOTE: can’t retreive this early 
 
Initiate archive retrieval 
aws glacier initiate­job ­­account­id ­ ­­vault­name edureka ­­job­parameters '{"ArchiveId": 
"T4SBmEIfLHqxlGPGis27khJ7ZHVCdjUdY0n62kfpkG5kOR7v87UPzwmjd­Y9NOvKx_qx_VHxBxEI74­OV4Qv
U5W9fNprx5i6b­8kN0v­46tH3FZGwNUCBLkFvbhpcil7invEHPdm_A", "Type":"archive­retrieval"}' 
 
View job status 
aws glacier list­jobs ­­account­id ­ ­­vault­name edureka 
 
Cleanup 
aws glacier delete­archive ­­account­id ­ ­­vault­name edureka ­­archive­id 
T4SBmEIfLHqxlGPGis27khJ7ZHVCdjUdY0n62kfpkG5kOR7v87UPzwmjd­Y9NOvKx_qx_VHxBxEI74­OV4QvU
5W9fNprx5i6b­8kN0v­46tH3FZGwNUCBLkFvbhpcil7invEHPdm_A 
aws glacier delete­vault ­­account­id ­ ­­vault­name edureka  
Note: Vault cannot be deleted unless archives are deleted 
 
   
Review/Assignments 
 
Topic  Review questions 

RDS  ● How are automated backups different from manual 
snapshots/backups? 
● How can read replicas be used for DR? 
● How can RDS snapshots be used for creating test/development 
environments? 
● What is the maximum retention period of automated backups? 

EBS  ● How can one ensure data integrity when EBS snapshots are being 
taken? 
● What are the ways in which EC2 instances can be recreated in a 
different region for DR? 

S3  ● What are object life cycle policies used for? 
● How can one protect data against failures of a region? 
● What are the 3 different types of storage offered by S3? 

Glacier  ● How long does it take typically to retreive an archive? 
● Compare Glacier pricing to S3 pricing 

Assignments 
● Create a complete backup, DR and test/development environment policy document for 
your project/organization 
● Implement your backup/DR/Environment policies using: 
○ EBS: Snapshots, AMI, Sharing AMI/Snapshots, Cross­region copying of 
Snapshots/AMI 
○ RDS: Automated backup, manual db snapshots, read replicas 
○ S3: Object life­cycle policies, cross­region replication, Glacier 
 

You might also like