AWS not working working from Cronjob

Put this code before your command line to be executed into crontab -e

SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

First: check where on your system the executable aws is stored. Use this command:

$ which aws
/usr/bin/aws # example output, can differ in your system

Now, place a variable called $PATH in your crontab before the script:

PATH=/usr/bin:/usr/local/bin

Those paths separated by : define where should be search for the exectable. In the example above it's /usr/bin. You have to check all executables in your cron job that they are available.

Another thing: try to avoid path with a tilde (~) in cronjobs. Use /home/user instead.


You should use the full path for the aws command. For example, /usr/local/bin/aws