Issue 59 and 49 - provide support for io1 type EBS

This commit is contained in:
Colin Johnson 2014-06-27 14:04:13 +00:00
parent c4e67c7422
commit dc85dde572
2 changed files with 6 additions and 11 deletions

View File

@ -1,8 +1,8 @@
ec2ab_exec="../ec2-automate-backup-awscli.sh" ec2ab_exec="../ec2-automate-backup-awscli.sh"
#create two volumes #create two volumes
volume_1=$(ec2-create-volume --size 2 GB --availability-zone us-east-1a) volume_1=$(ec2-create-volume --size 5 GB --availability-zone us-east-1c --type io1 --iops 100)
volume_2=$(ec2-create-volume --size 2 GB --availability-zone us-east-1a) volume_2=$(ec2-create-volume --size 2 GB --availability-zone us-east-1c)
#get volume id of both volumes #get volume id of both volumes
volume_1_id=$(echo "$volume_1" | cut -f 2) volume_1_id=$(echo "$volume_1" | cut -f 2)

View File

@ -42,14 +42,12 @@ get_EBS_List() {
*) echo "If you specify a selection_method (-s selection_method) for selecting EBS volumes you must select either \"volumeid\" (-s volumeid) or \"tag\" (-s tag)." 1>&2 ; exit 64 ;; *) echo "If you specify a selection_method (-s selection_method) for selecting EBS volumes you must select either \"volumeid\" (-s volumeid) or \"tag\" (-s tag)." 1>&2 ; exit 64 ;;
esac esac
#creates a list of all ebs volumes that match the selection string from above #creates a list of all ebs volumes that match the selection string from above
ebs_backup_list_complete=$(aws ec2 describe-volumes --region $region $ebs_selection_string --output text) ebs_backup_list=$(aws ec2 describe-volumes --region $region $ebs_selection_string --output text --query 'Volumes[*].VolumeId')
#takes the output of the previous command #takes the output of the previous command
ebs_backup_list_result=$(echo $?) ebs_backup_list_result=$(echo $?)
if [[ $ebs_backup_list_result -gt 0 ]]; then if [[ $ebs_backup_list_result -gt 0 ]]; then
echo -e "An error occured when running ec2-describe-volumes. The error returned is below:\n$ebs_backup_list_complete" 1>&2 ; exit 70 echo -e "An error occured when running ec2-describe-volumes. The error returned is below:\n$ebs_backup_list_complete" 1>&2 ; exit 70
fi fi
#returns the list of EBS volumes that matched ebs_selection_string. grep ^VOLUMES is to remove lines that begin "TAGS Backup"
ebs_backup_list=$(echo "$ebs_backup_list_complete" | grep ^VOLUMES | cut -f 8)
} }
create_EBS_Snapshot_Tags() { create_EBS_Snapshot_Tags() {
@ -110,12 +108,9 @@ esac
} }
purge_EBS_Snapshots() { purge_EBS_Snapshots() {
# snapshot_tag_list is a string containing any snapshot that contains a tag # snapshot_purge_allowed is a string containing the SnapshotIDs of snapshots
# with the key value/pair PurgeAllow=true # that contain a tag with the key value/pair PurgeAllow=true
snapshot_tag_list=$(aws ec2 describe-snapshots --region $region --filters Name=tag:PurgeAllow,Values=true --output text | grep ^SNAPSHOTS) snapshot_purge_allowed=$(aws ec2 describe-snapshots --region $region --filters Name=tag:PurgeAllow,Values=true --output text --query 'Snapshots[*].SnapshotId')
# snapshot_purge_allowed is a string containing Snapshot IDs that are
# allowed to be purged
snapshot_purge_allowed=$(echo "$snapshot_tag_list" | cut -f 7)
for snapshot_id_evaluated in $snapshot_purge_allowed; do for snapshot_id_evaluated in $snapshot_purge_allowed; do
#gets the "PurgeAfterFE" date which is in UTC with UNIX Time format (or xxxxxxxxxx / %s) #gets the "PurgeAfterFE" date which is in UTC with UNIX Time format (or xxxxxxxxxx / %s)