Question:
I have this script:
1 2 3 4 5 6 7 |
#!/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games SHELL=/bin/bash # Create EBS Data snapshot /usr/local/bin/aws ec2 create-snapshot --volume-id "vol-XXXXX" --description "test" |
It works perfectly if I run it from the shell, but does nothing with Cron. Why? I am using IAM roles, is it important?
Answer:
Ok, after several hours I found the solution:
The user root was running the script but AWS was not configured for this user. I only needed to configure AWS for the user root:
1 2 |
# aws configure |