Reputation: 834
I have created a windows scheduled task to run an aws
command to sync a local folder to an S3 bucket. The task runs a .bat file. If the .bat is ran manually, it runs fine. When it is run via the task I get a 0x1 as the last run result.
Following advice found here, my bat file looks like this:
set AWS_CONFIG_FILE=C:\Users\xxx\.aws\config
set AWS_ACCESS_KEY_ID=xxx
set AWS_SECRET_ACCESS_KEY=xxx
aws s3 sync "C:\my_local_folder" s3://my_bucket --delete
xxx
in set AWS_CONFIG_FILE=C:\Users\xxx\.aws\config
is the correct path to the .aws\config
folder.
My task looks like this:
The account being used is an admin account, is already successfully running other scheduled tasks and the paths in the task are correct.
Upvotes: 2
Views: 3770
Reputation: 834
Courtesy @JohnRotenstein's comment about redirecting output, I changed the command to be:
"C:\Program Files\Amazon\AWSCLI\aws.exe" s3 sync "C:\my_local_folder" s3://my_bucket --delete
Upvotes: 2