Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec2 automate backup by tag not working #91

Open
nodesocket opened this issue Jun 24, 2015 · 8 comments
Open

ec2 automate backup by tag not working #91

nodesocket opened this issue Jun 24, 2015 · 8 comments

Comments

@nodesocket
Copy link

Trying to backup volumes tagged with Backup=true but when I run ec2-automate-backup, it does not detect any volumes. I am using the CLI version.

ubuntu@ip-10-0-63-186:~$ ./ec2-automate-backup.sh -r us-west-1 -s tag -t "Backup=true"
ubuntu@ip-10-0-63-186:~$

screen shot 2015-06-24 at 4 36 49 pm

@netstx
Copy link

netstx commented Jun 24, 2015

Here is how I have been using it:

/ec2-automate-backup-awscli.sh -c /etc/cron-primer.sh -r us-east-1 -s tag -t
backup,Values=true
-n -k 1 -h -p

your -t argument isn't being understood by the script :)

On Wed, Jun 24, 2015 at 6:38 PM, Justin Keller [email protected]
wrote:

Trying to backup volumes tagged with Backup=true but when I run
ec2-automate-backup, it does not detect any volumes. I am using the CLI
version.

ubuntu@ip-10-0-63-186:$ ./ec2-automate-backup.sh -r us-west-1 -s tag -t "Backup=true"
ubuntu@ip-10-0-63-186:
$

[image: screen shot 2015-06-24 at 4 36 49 pm]
https://cloud.githubusercontent.com/assets/523312/8343882/3d8c2f94-1a8f-11e5-9ea3-1ede5a04ecff.png


Reply to this email directly or view it on GitHub
#91.

@nodesocket
Copy link
Author

./ec2-automate-backup.sh -r us-west-1 -s tag -t "Backup,Values=true"

Still not working.

@netstx
Copy link

netstx commented Jun 24, 2015

Try not use the quotes "", I never used quotes on mine. Just type exactly
how mine is. If that does not solve the problem, you should see if your aws
cli roles are working.

On Wed, Jun 24, 2015 at 6:53 PM, Justin Keller [email protected]
wrote:

./ec2-automate-backup.sh -r us-west-1 -s tag -t "Backup,Values=true"

Still not working.


Reply to this email directly or view it on GitHub
#91 (comment)
.

@nodesocket
Copy link
Author

It takes longer, but still not output using. Just to confirm, you put the tag on volumes, not ec2 instances right?

ubuntu@ip-10-0-63-186:~$ ./ec2-automate-backup.sh -r us-west-1 -s tag -t Backup,Values=true
ubuntu@ip-10-0-63-186:~$

Running:

aws ec2 describe-volumes

Works, and displays all the volumes.

@nodesocket
Copy link
Author

Nevermind, it appears to have worked (there are snapshots), just no output logged. Should there be output?

@netstx
Copy link

netstx commented Jun 25, 2015

Yes, just not sure how to get it from console, but when I run on crontab it outputs a line for each snapshot

Sent from my mobile device

On Jun 24, 2015, at 7:06 PM, Justin Keller [email protected] wrote:

Nevermind, it appears to have worked (there are snapshots), just no output logged. Should there be output?


Reply to this email directly or view it on GitHub.

@rxl881
Copy link

rxl881 commented Jul 10, 2015

I am also seeing the same issue as nodesocket. It appears to be an issue with the way in which the string "--query 'Volumes[*].VolumeId'" is being evaluated when creating a list of the ebs volumes.
I have been able to resolve the issue by wrapping the statement in backticks (rather than $()), as I couldn't get normal bash escaping tricks to fix the issue.

diff --git a/ec2-automate-backup/ec2-automate-backup-awscli.sh b/ec2-automate-backup/ec2-automate-backup-awscli.sh
index 52fe606..dfb8dde 100755
--- a/ec2-automate-backup/ec2-automate-backup-awscli.sh
+++ b/ec2-automate-backup/ec2-automate-backup-awscli.sh
@@ -42,7 +42,7 @@ 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 ;;
   esac
   #creates a list of all ebs volumes that match the selection string from above
-  ebs_backup_list=$(aws ec2 describe-volumes --region $region $ebs_selection_string --output text --query 'Volumes[*].VolumeId')
+  ebs_backup_list=`aws ec2 describe-volumes --region $region $ebs_selection_string --output text --query 'Volumes[*].VolumeId'`
   #takes the output of the previous command 
   ebs_backup_list_result=$(echo $?)
   if [[ $ebs_backup_list_result -gt 0 ]]; then

@samizzo
Copy link

samizzo commented Aug 26, 2015

I didn't get the above issue, but at first the tag format was confusing me. The aws cli documentation explains the filter format in a confusing and unclear way, and there's only one example in the readme here for the tags, but just to clarify, if you're using the aws cli version of this script, you should specify the tags as follows:

-t Backup,Values=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants