From 282a798112f9b2b19627f950ecea9dfa69431c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torgeir=20Lorange=20=C3=98stby?= Date: Tue, 19 Feb 2013 16:13:00 +0100 Subject: [PATCH 1/8] Corrected the initial max size to read from field 9. --- aws-ha-release/aws-ha-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-ha-release/aws-ha-release.sh b/aws-ha-release/aws-ha-release.sh index 6ecfbfe..139ac2d 100755 --- a/aws-ha-release/aws-ha-release.sh +++ b/aws-ha-release/aws-ha-release.sh @@ -93,7 +93,7 @@ fi #gets Auto Scaling Group max-size -asg_initial_max_size=`echo $asg_result | grep ^AUTO-SCALING-GROUP | cut -d "$delimiter" -f 10` +asg_initial_max_size=`echo $asg_result | grep ^AUTO-SCALING-GROUP | cut -d "$delimiter" -f 9` asg_temporary_max_size=$(($asg_initial_max_size+1)) #gets Auto Scaling Group desired-capacity asg_initial_desired_capacity=`echo "$asg_result" | grep ^AUTO-SCALING-GROUP | cut -d "$delimiter" -f 10` From 9c69efc5e375b31e1fa1ce19ea2ab202f3509bb8 Mon Sep 17 00:00:00 2001 From: Colin Johnson Date: Wed, 3 Apr 2013 22:52:00 +0000 Subject: [PATCH 2/8] Update ec2-write-memory-metrics.sh Removing typo - had duplicate curl command. --- ec2-write-memory-metrics/ec2-write-memory-metrics.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ec2-write-memory-metrics/ec2-write-memory-metrics.sh b/ec2-write-memory-metrics/ec2-write-memory-metrics.sh index c61ef8a..dcb84a5 100644 --- a/ec2-write-memory-metrics/ec2-write-memory-metrics.sh +++ b/ec2-write-memory-metrics/ec2-write-memory-metrics.sh @@ -1,7 +1,7 @@ #!/bin/bash - #get instance id - used for putting metric INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id` -INSTANCE_AZ=`curl -s curl http://169.254.169.254/latest/meta-data/placement/availability-zone/` +INSTANCE_AZ=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone/` INSTANCE_REGION=${INSTANCE_AZ%?} #could be done using "free" or "vmstat" - use of less and grep is believed to provide widest compatibility - CJ 2011-11-24 @@ -15,4 +15,4 @@ mon-put-data --region $INSTANCE_REGION --metric-name MemoryFree --namespace EC2/ mon-put-data --region $INSTANCE_REGION --metric-name SwapUsed --namespace EC2/Memory --value $swapused --unit Kilobytes --dimensions "InstanceId=$INSTANCE_ID" #to run in cron every 5 minutes - note that you must first provide credentials for mon-put-data -#echo "*/5 * * * * ec2-user /usr/local/bin/ec2-write-memory-metrics.sh" > /etc/cron.d/ec2-write-memory-metrics \ No newline at end of file +#echo "*/5 * * * * ec2-user /usr/local/bin/ec2-write-memory-metrics.sh" > /etc/cron.d/ec2-write-memory-metrics From 1d9540963e47cd2b8cd247700b846544d4ce9d9a Mon Sep 17 00:00:00 2001 From: Colin Johnson Date: Wed, 3 Apr 2013 22:53:02 +0000 Subject: [PATCH 3/8] Removing typo - had duplicate curl command. --- ec2-write-storage-used/ec2-write-storage-used.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ec2-write-storage-used/ec2-write-storage-used.sh b/ec2-write-storage-used/ec2-write-storage-used.sh index dd8a71f..e7680ba 100644 --- a/ec2-write-storage-used/ec2-write-storage-used.sh +++ b/ec2-write-storage-used/ec2-write-storage-used.sh @@ -1,7 +1,7 @@ #!/bin/bash - #get instance id - used for putting metric INSTANCE_ID=`GET http://169.254.169.254/latest/meta-data/instance-id` -INSTANCE_AZ=`curl -s curl http://169.254.169.254/latest/meta-data/placement/availability-zone/` +INSTANCE_AZ=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone/` INSTANCE_REGION=${INSTANCE_AZ%?} #belowshould be changed to grep - get only everything after % space slash @@ -14,4 +14,4 @@ for filesystemmountpoint in $filesystemlist done #to run in cron every 5 minutes - note that you must first provide credentials for mon-put-data -#echo "*/5 * * * * ec2-user /usr/local/bin/ec2-write-storage-used.sh" > /etc/cron.d/ec2-write-storage-used \ No newline at end of file +#echo "*/5 * * * * ec2-user /usr/local/bin/ec2-write-storage-used.sh" > /etc/cron.d/ec2-write-storage-used From 917b3c8aa1ec1c50b9d4cf5fa9cfa39e3ed69257 Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 10 Apr 2013 08:19:33 -0500 Subject: [PATCH 4/8] Update ec2ab - IAM User Required Permissions.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Spelling mistake. Included invalid action; "Deletenapshot". Already correctly defined as "DeleteSnapshot" --- .../Resources/ec2ab - IAM User Required Permissions.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ec2-automate-backup/Resources/ec2ab - IAM User Required Permissions.json b/ec2-automate-backup/Resources/ec2ab - IAM User Required Permissions.json index 438eb1c..5dc2bec 100644 --- a/ec2-automate-backup/Resources/ec2ab - IAM User Required Permissions.json +++ b/ec2-automate-backup/Resources/ec2ab - IAM User Required Permissions.json @@ -6,7 +6,6 @@ "ec2:CreateSnapshot", "ec2:DeleteSnapshot", "ec2:CreateTags", - "ec2:Deletenapshot", "ec2:DescribeTags" ], "Effect": "Allow", @@ -15,4 +14,4 @@ ] } ] -} \ No newline at end of file +} From 09cee91c56574be2cedda7f9d7682e0a4f777d7b Mon Sep 17 00:00:00 2001 From: Dave Stern Date: Tue, 9 Apr 2013 17:46:36 -0400 Subject: [PATCH 5/8] Region Copy: -g and -d options to tag and initiate region copies -g tested with new backups using: bash ec2-automate-backup.sh -v 'vol-8a1a43f6 vol-2a78d459' -g 'us-west-1 us-west-2' -n -d tested with various options and repeated calls to test idempotent copies: bash ec2-automate-backup.sh -s regioncopy -d 'us-west-1' bash ec2-automate-backup.sh -s regioncopy -d 'us-west-1' bash ec2-automate-backup.sh -s regioncopy -d 'us-west-1 us-west-2' bash ec2-automate-backup.sh -s regioncopy -d 'us-west-2' etc. --- .../Beta/ec2-automate-backup.sh | 103 +++++++++++++++--- 1 file changed, 88 insertions(+), 15 deletions(-) diff --git a/ec2-automate-backup/Beta/ec2-automate-backup.sh b/ec2-automate-backup/Beta/ec2-automate-backup.sh index fa46302..9f823d3 100755 --- a/ec2-automate-backup/Beta/ec2-automate-backup.sh +++ b/ec2-automate-backup/Beta/ec2-automate-backup.sh @@ -27,27 +27,38 @@ get_EBS_List() fi ebs_selection_string="$volumeid" ;; - tag) + tag) if [[ -z $tag ]] then echo "The selected selection_method \"tag\" (-s tag) requires a valid tag (-t key=value) for operation. Correct usage is as follows: \"-s tag -t backup=true\" or \"-s tag -t Name=my_tag.\"" 1>&2 ; exit 64 fi ebs_selection_string="--filter tag:$tag" ;; + regioncopy) + if [[ -z $region_copy_destinations ]] + then echo "The selected selection_method \"regioncopy\" (-s regioncopy) requires valid region names (-d '[region name(s)]') or 'all' for operation. Correct usage is as follows: \"-s regioncopy -d 'us-west-1'\" or \"-s regioncopy -d 'us-west-1 us-west-2'.\"" 1>&2 ; exit 64 + fi + ;; *) 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 - #creates a list of all ebs volumes that match the selection string from above - ebs_backup_list_complete=`ec2-describe-volumes --show-empty-fields --region $region $ebs_selection_string 2>&1` - #takes the output of the previous command - ebs_backup_list_result=`echo $?` - 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 + + if [[ -n $ebs_selection_string ]] + then + #creates a list of all ebs volumes that match the selection string from above + ebs_backup_list_complete=`ec2-describe-volumes --show-empty-fields --region $region $ebs_selection_string 2>&1` + #takes the output of the previous command + ebs_backup_list_result=`echo $?` + 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 + fi + ebs_backup_list=`echo "$ebs_backup_list_complete" | grep ^VOLUME | cut -f 2` + #code to right will output list of EBS volumes to be backed up: echo -e "Now outputting ebs_backup_list:\n$ebs_backup_list" fi - ebs_backup_list=`echo "$ebs_backup_list_complete" | grep ^VOLUME | cut -f 2` - #code to right will output list of EBS volumes to be backed up: echo -e "Now outputting ebs_backup_list:\n$ebs_backup_list" } create_EBS_Snapshot_Tags() { + echo "create_EBS_Snapshot_Tags region_copy_scheduled_destinations=$region_copy_scheduled_destinations" + #snapshot tags holds all tags that need to be applied to a given snapshot - by aggregating tags we ensure that ec2-create-tags is called only onece snapshot_tags="" #if $name_tag_create is true then append ec2ab_${ebs_selected}_$current_date to the variable $snapshot_tags @@ -68,6 +79,15 @@ create_EBS_Snapshot_Tags() snapshot_tags="$snapshot_tags --tag Volume=${ebs_selected} --tag Created=$current_date" fi + #if $name_tag_create is true then append RegionCopy=[region]:scheduled,[region]:scheduled to the variable $snapshot_tags + if [[ -n $region_copy_scheduled_destinations ]] + then + ec2_snapshot_resource_id=`echo "$ec2_create_snapshot_result" | cut -f 2` + regions=$(echo $region_copy_scheduled_destinations | sed 's/ */:scheduled,/g') + snapshot_tags="$snapshot_tags --tag RegionCopy=${regions}:scheduled" + echo "tagging $ec2_snapshot_resource_id with $snapshot_tags" + fi + #if $snapshot_tags is not zero length then set the tag on the snapshot using ec2-create-tags if [[ -n $snapshot_tags ]] then echo "Tagging Snapshot $ec2_snapshot_resource_id with the following Tags:" @@ -113,7 +133,7 @@ purge_EBS_Snapshots() snapshot_tag_list=`ec2-describe-tags --show-empty-fields --region $region --filter resource-type=snapshot --filter key=PurgeAllow,PurgeAfterFE` #snapshot_purge_allowed is a list of all snapshot_ids with PurgeAllow=true snapshot_purge_allowed=`echo "$snapshot_tag_list" | grep .*PurgeAllow'\s'true | cut -f 3` - + for snapshot_id_evaluated in $snapshot_purge_allowed do #gets the "PurgeAfterFE" date which is in UTC with UNIX Time format (or xxxxxxxxxx / %s) @@ -133,6 +153,50 @@ purge_EBS_Snapshots() done } +region_copy_EBS_Snapshots() +{ + #snapshots_to_region_copy is a list of all snapshot_ids with RegionCopy=.*:scheduled.* + # --output-delimiter and $'n' substitution used so $IFS doesn't have to be + # manipulated with for loops and the cut command + snapshot_tag_list=$(ec2-describe-tags --show-empty-fields --region $region --filter resource-type=snapshot --filter key=RegionCopy | grep ':scheduled' | cut -f3,5- --output-delimiter='~') + + for snapshot_data in $(echo ${snapshot_tag_list//$'\n'/ } | cut -f1-) + do + snapshot_id=$(echo $snapshot_data | cut -d'~' -f1) + regions=$(echo $snapshot_data | cut -d'~' -f2-) + original_regions=$regions + region_copy_tag='' + for region_data in ${regions//,/ } + do + destination_region=$(echo $region_data | cut -d: -f1) + status=$(echo $region_data | cut -d: -f2-) + region_copy_tag_append="$destination_region:$status" + if [[ "$region_copy_destinations" = "all" || -n $(echo "$region_copy_destinations"| grep $destination_region) ]] + then + current_datetime=$(date +%Y-%m-%d_%H:%M:%S) + if [ "$status" = "scheduled" ] + then + ec2_copy_snapshot_complete=$(ec2-copy-snapshot -r $region -s $snapshot_id --region $destination_region) + ec2_copy_snapshot_result=`echo $?` + if [[ $ec2_copy_snapshot_result -gt 0 ]] + then + echo -e "An error occured when running ec2-copy-snapshot. The error returned is below:\n$ec2_copy_snapshot_complete" 1>&2 ; exit 70 + else + region_copy_tag_append="$destination_region:$current_datetime" + echo "The snapshot \"$snapshot_id\" is being copied to $destination_region." + fi + fi + fi + region_copy_tag="${region_copy_tag},$region_copy_tag_append" + done + + if [[ "${region_copy_tag#,}" != "$original_regions" ]] + then + ec2-create-tags $snapshot_id --region $region --tag RegionCopy=${region_copy_tag#,} + fi + done +} + app_name=`basename $0` #sets defaults @@ -148,7 +212,7 @@ user_tags=false #sets the Purge Snapshot feature to false - this feature will eventually allow the removal of snapshots that have a "PurgeAfterFE" tag that is earlier than current date purge_snapshots=false #handles options processing -while getopts :s:c:r:v:t:k:pnu opt +while getopts :s:c:r:v:t:k:g:d:l:pnu opt do case $opt in s) selection_method="$OPTARG";; @@ -157,6 +221,8 @@ while getopts :s:c:r:v:t:k:pnu opt v) volumeid="$OPTARG";; t) tag="$OPTARG";; k) purge_after_input="$OPTARG";; + g) region_copy_scheduled_destinations="$OPTARG";; + d) region_copy_destinations="$OPTARG";; n) name_tag_create=true;; p) purge_snapshots=true;; u) user_tags=true;; @@ -166,7 +232,7 @@ while getopts :s:c:r:v:t:k:pnu opt #sources "cron_primer" file for running under cron or other restricted environments - this file should contain the variables and environment configuration required for ec2-automate-backup to run correctly if [[ -n $cron_primer ]] - then if [[ -f $cron_primer ]] + then if [[ -f $cron_primer ]] then source $cron_primer else echo "Cron Primer File \"$cron_primer\" Could Not Be Found." 1>&2 ; exit 70 @@ -177,7 +243,7 @@ fi if [[ -z $region ]] #if the environment variable $EC2_REGION is not set set to us-east-1 then if [[ -z $EC2_REGION ]] - #if both + #if both then region="us-east-1" else region=$EC2_REGION @@ -213,7 +279,7 @@ do then echo -e "An error occured when running ec2-create-snapshot. The error returned is below:\n$ec2_create_snapshot_result" 1>&2 ; exit 70 else ec2_snapshot_resource_id=`echo "$ec2_create_snapshot_result" | cut -f 2` - fi + fi create_EBS_Snapshot_Tags done @@ -221,4 +287,11 @@ done if $purge_snapshots then echo "Snapshot Purging is Starting Now." purge_EBS_Snapshots -fi \ No newline at end of file +fi + +#if region_copy_destinations is true, then run region_copy_EBS_Snapshots function +if [[ -n $region_copy_destinations ]] + then echo "Snapshot Copying to regions $region_copy_destinations is Starting Now." + region_copy_EBS_Snapshots +fi + From c63fc636e6576fe7163a687378c28500858ca57a Mon Sep 17 00:00:00 2001 From: Dave Stern Date: Wed, 10 Apr 2013 14:51:55 -0400 Subject: [PATCH 6/8] Region Copy: Mac cut doesn't have --output-delimiter, use tr instead --- ec2-automate-backup/Beta/ec2-automate-backup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ec2-automate-backup/Beta/ec2-automate-backup.sh b/ec2-automate-backup/Beta/ec2-automate-backup.sh index 9f823d3..9e4f589 100755 --- a/ec2-automate-backup/Beta/ec2-automate-backup.sh +++ b/ec2-automate-backup/Beta/ec2-automate-backup.sh @@ -156,9 +156,9 @@ purge_EBS_Snapshots() region_copy_EBS_Snapshots() { #snapshots_to_region_copy is a list of all snapshot_ids with RegionCopy=.*:scheduled.* - # --output-delimiter and $'n' substitution used so $IFS doesn't have to be + # tr and $'n' substitution used so $IFS doesn't have to be # manipulated with for loops and the cut command - snapshot_tag_list=$(ec2-describe-tags --show-empty-fields --region $region --filter resource-type=snapshot --filter key=RegionCopy | grep ':scheduled' | cut -f3,5- --output-delimiter='~') + snapshot_tag_list=$(ec2-describe-tags --show-empty-fields --region $region --filter resource-type=snapshot --filter key=RegionCopy | grep ':scheduled' | cut -f3,5- | tr '[\t ]' '~') for snapshot_data in $(echo ${snapshot_tag_list//$'\n'/ } | cut -f1-) do From 27f88ef5a1a9fad1dd7e21f800acfbb0e5202411 Mon Sep 17 00:00:00 2001 From: Dave Stern Date: Wed, 10 Apr 2013 15:06:05 -0400 Subject: [PATCH 7/8] Region Copy: Modified prerequisite_check for conditional usage --- ec2-automate-backup/Beta/ec2-automate-backup.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ec2-automate-backup/Beta/ec2-automate-backup.sh b/ec2-automate-backup/Beta/ec2-automate-backup.sh index 9e4f589..33d1721 100755 --- a/ec2-automate-backup/Beta/ec2-automate-backup.sh +++ b/ec2-automate-backup/Beta/ec2-automate-backup.sh @@ -7,7 +7,14 @@ #confirms that executables required for succesful script execution are available prerequisite_check() { - for prerequisite in basename ec2-create-snapshot ec2-create-tags ec2-describe-snapshots ec2-delete-snapshot date + check_values=$1 + + if [[ -z $check_values ]] + then + check_values='ec2-create-snapshot ec2-create-tags ec2-describe-snapshots ec2-delete-snapshot date' + fi + + for prerequisite in basename $check_values do #use of "hash" chosen as it is a shell builtin and will add programs to hash table, possibly speeding execution. Use of type also considered - open to suggestions. hash $prerequisite &> /dev/null @@ -292,6 +299,7 @@ fi #if region_copy_destinations is true, then run region_copy_EBS_Snapshots function if [[ -n $region_copy_destinations ]] then echo "Snapshot Copying to regions $region_copy_destinations is Starting Now." + prerequisite_check ec2-copy-snapshot region_copy_EBS_Snapshots fi From b05ddd21c4b77ce4c2ccde1b5483514931eb1f5d Mon Sep 17 00:00:00 2001 From: Dave Stern Date: Wed, 10 Apr 2013 15:15:57 -0400 Subject: [PATCH 8/8] Region Copy: Updated README with new features --- ec2-automate-backup/Beta/README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ec2-automate-backup/Beta/README.md b/ec2-automate-backup/Beta/README.md index 92d9b91..545c48b 100644 --- a/ec2-automate-backup/Beta/README.md +++ b/ec2-automate-backup/Beta/README.md @@ -22,12 +22,14 @@ the above example would provide a single backup of the EBS volumeid vol-6d6a0527 ec2-automate-backup requires one of the following two parameters be provided: `-v ` - the "volumeid" parameter is required to select EBS volumes for snapshot if ec2-automate-backup is run using the "volumeid" selection method - the "volumeid" selection method is the default selection method. - + `-t ` - the "tag" parameter is required if the "method" of selecting EBS volumes for snapshot is by tag (-s tag). The format for tag is key=value (example: Backup=true) and the correct method for running ec2-automate-backup in this manner is ec2-automate-backup -s tag -t Backup=true. + +`-d ` - the "destination region" parameter is required if the "method" of selecting EBS snapshots for copy to another region is by region (-s regioncopy). The format for `-d` is space-delimited region names such as ec2-automate-backup.sh -s regioncopy -d "us-west-1 us-west-2". This selection method only operates on snapshots. ## Optional Parameters: `-r ` - the region that contains the EBS volumes for which you wish to have a snapshot created. -`-s ` - the selection method by which EBS volumes will be selected. Currently supported selection methods are "volumeid" and "tag." The selection method "volumeid" identifies EBS volumes for which a snapshot should be taken by volume id whereas the selection method "tag" identifies EBS volumes for which a snapshot should be taken by a key=value format tag. +`-s ` - the selection method by which EBS volumes will be selected. Currently supported selection methods are "volumeid", "tag" and "regioncopy." The selection method "volumeid" identifies EBS volumes for which a snapshot should be taken by volume id whereas the selection method "tag" identifies EBS volumes for which a snapshot should be taken by a key=value format tag. The selection method "regioncopy" identifies regions as destinations for EBS volumes that have been scheduled for copy to that region. `-c ` - running with the -c option and a providing a file will cause ec2-automate-backup to source a file for environmental configuration - ideal for running ec2-automate-backup under cron. An example cron primer file is located in the "Resources" directory and is called cron-primer.sh. @@ -36,14 +38,18 @@ ec2-automate-backup requires one of the following two parameters be provided: `-k ` - the period after which a snapshot can be purged. For example, running "ec2-automate-backup.sh -v "vol-6d6a0527 vol-636a0112" -k 31" would allow snapshots to be removed after 31 days. purge_after_period creates two tags for each volume that was backed up - a PurgeAllow tag which is set to PurgeAllow=true and a PurgeAfterFE tag which is set to the number of minutes from epoch after which a snapshot can be purged. Values can also be entered as -k 60m (this would purge snapshots after 60 minutes or -k 2h (this would purge snapshots after 2 hours) or -k 7d (this would purge snapshots after 7 days). With no trailing characters the purge after period defaults to days. `-p` - the -p flag will purge (meaning delete) all snapshots that where the current date is passed the volumes "PurgeAfterFE" tag. ec2-automate-backup looks at two tags to determine which snapshots should be deleted - the PurgeAllow and PurgeAfterFE tags. The tags must be set as follows: PurgeAllow=true and PurgeAfterFE=xxxxxxxxxx where xxxxxxxxxx is a UNIX time that is before the current date. + +`-g ` - Space-delimited destination regions for the volumes selected. This is added when the `-v` or `-t` selection method is used. Note that this only adds a tag that schedules the snapshot to be copied to the destinations. On subsequent calls, the `-d` parameter will intiate copies to the specified regions. # Potential Uses and Methods of Use: * To backup multiple EBS volumes use ec2-automate-backup as follows: `ec2-automate-backup -v "vol-6d6a0527 vol-636a0112"` +* To backup multiple EBS volumes and schedule them for copy to two other regions: `ec2-automate-backup -v "vol-6d6a0527 vol-636a0112" -g "us-west-1 us-west-2"` * To backup a selected group of EBS volumes on a daily schedule tag each volume you wish to backup with the tag "Backup=true" and run ec2-automate-backup using cron as follows: `0 0 * * 0 ec2-automate-backup -s tag -t "Backup=true"` * To backup a selected group of EBS volumes on a daily and/or monthly schedule tag each volume you wish to backup with the tag "Backup-Daily=true" and/or "Backup-Monthly=true" and run ec2-automate-backup using cron as follows: - `0 0 * * 0 ec2-user /home/ec2-user/ec2-automate-backup.sh -s tag -t "Backup-Daily=true"` - `0 0 1 * * ec2-user /home/ec2-user/ec2-automate-backup.sh -s tag -t "Backup-Monthly=true"` * To perform daily backup using cron and to load environment configuration with a "cron-primer" file: - `0 0 * * 0 ec2-user /home/ec2-user/ec2-automate-backup.sh -c /home/ec2-user/cron-primer.sh -s tag -t "Backup=True"` +* To initiate the copy of scheduled snapshots to their destination regions: `ec2-automate-backup.sh -s regioncopy -d "us-west-1 us-west-2"` `-u` - the -u flag will tag snapshots with additional data so that snapshots can be more easily located. Currently the two user tags created are Volume="ebs_volume" and Created="date." These can be easily modified in code.