I have a Linode (Ubuntu 16.04) from which I am trying to copy files to an AWS S3 bucket via a cron job calling a script, but the log outputs:
upload failed: ../path/file.ext to s3://bucket/prefix/file.ext Unable to locate credentials
tars a directory, and then uploads that tar to my s3 bucket
- The script works start to finish if I call it directly via
- As a root cron job, the
tarworks, but the
awsupload doesn't (with error noted above)
- As a [user] cron job, the
tarfails (intentional permissions related), but the
- When I installed AWS CLI, I forget exactly how it was worded, but I chose to have it installed for all users
Things I've Tried
- Having my script call
/usr/local/bin/awsto the PATH in crontab, and also in my script
AWS_CONFIG_FILE="/home/[user]/.aws/config"in crontab, and also in my script
aws configureas root
- Following this tip, and comparing cron and interactive environments. My env.cron
PATHincludes everything listed in my env.interactive
PATH, plus a few more, even some duplicates - is that bad?
There are many more statements in my env.interactive (1810 lines) compared to my env.cron (36 lines). It must be something in my environment differences, right? I've searched my env.interactive for any instance of
aws, but there is none, even though that env works just fine. Any tips on other specific items to look for in there?
Any ideas and help are appreciated! Thanks!