cloudavail/aws-missing-tools

Instruction for ec2-automate-backup on Ubuntu 14 server

jgardezi opened this issue · 7 comments

Hi,

I am having issues running ec2-automate-backup.sh as cron Job on Ubuntu 14 server. When I run a command
/home/backup-agent/scripts/ec2-automate-backup.sh -s tag -t Backup,Values=true -k 31 -r ap-southeast-2 on terminal it works fine and I can see it also creates snapshots.

The issue is when I try run this as a cron job it does not work. This is my cron command and I am trying to run it on 11pm every day. I have used crontab -e to schedule the cron job.
00 23 * * * /home/backup-agent/scripts/ec2-automate-backup.sh -s tag -t Backup,Values=true -k 31 -r ap-southeast-2

Please let me know what is going on or any steps I am missing i.e. cron-primer.sh?

Kind regards,
Javed Gardezi

same problem

Hi @insiderq

I resolved this issue by issues the following command. It is not picking up role permissions assigned to ec2.

55 23 * * * root AWS_CONFIG_FILE="/path/to/aws/config" /path/to/this/ebs-snapshot.sh > /var/log/ebs-snapshot.log 2>&1

You can further debug the issue by outputting them to log file and see what's going on.

I think the problem is in something different. The output shows me nothing. Program works but does nothing.

Did you tagged ebs volumes?

This command works perfectly in shell and really outputs to the log, but when i add it to the crontab it with even * * * * * it seem's to be work, since it empties the log file.
/home/ubuntu/aws-missing-tools/ec2-automate-backup/ec2-automate-backup.sh -s tag -t "Backup,Values=true" -r eu-west-1 -p -k 31 -n -u > /home/ubuntu/backup.log

Same problem here.

@insiderq you need to output the error to log file, attach 2>&1 at the end of your cron job.

My error output:
Traceback (most recent call last):
File "/usr/bin/aws", line 23, in
sys.exit(main())
File "/usr/bin/aws", line 19, in main
return awscli.clidriver.main()
File "/usr/share/awscli/awscli/clidriver.py", line 44, in main
driver = create_clidriver()
File "/usr/share/awscli/awscli/clidriver.py", line 53, in create_clidriver
event_hooks=emitter)
File "/usr/share/awscli/awscli/plugin.py", line 44, in load_plugins
modules = _import_plugins(plugin_mapping)
File "/usr/share/awscli/awscli/plugin.py", line 61, in _import_plugins
module = import(path, fromlist=[module])
File "/usr/share/awscli/awscli/handlers.py", line 24, in
from awscli.customizations.ec2addcount import ec2_add_count
File "/usr/share/awscli/awscli/customizations/ec2addcount.py", line 16, in
from botocore.parameters import StringParameter
ImportError: No module named 'botocore.parameters'
An error occurred when running ec2-describe-volumes. The error returned is below:

@jgardezi solution doens't work for me.

This is my solution, looks like there are a conflict with awscli installed from pip and apt-get, so i removed awscli with apt-get and reinstall with pip.

sudo apt-get purge awscli
sudo pip install awscli --upgrade --force-reinstall

After this you need to create a link to aws executable:

sudo ln -s /usr/local/bin/aws /usr/bin/aws