07-23-2023, 06:48 AM
I have a batch file `C:\upload_to_s3.bat`. In this file, there is a line:
aws s3 sync D:\S3\batch1\ s3://MyBucket/batch1 --exclude *.bat
I have Windows task scheduler "S3 Hourly Sync" that runs every hour to trigger to run `C:\upload_to_s3.bat`. But this command does not do anything - the file upload never happened.
It runs perfectly if I double click on `C:\upload_to_s3.bat`.
This is Windows 2008 Standard server. I have installed AWS CLI and configured with the command "aws configure", and entered my access key and secret key. That is why it runs if I double click the batch file.
The Windows Task Scheduler is run as "`[MyServer]/Administrator`" account.
So why doesn't the "`aws s3 sync`" command work when triggered by the task scheduler?
Do I need to add a line before "`aws s3 sync`" to set credentials first? If so, how?
Thank you!
aws s3 sync D:\S3\batch1\ s3://MyBucket/batch1 --exclude *.bat
I have Windows task scheduler "S3 Hourly Sync" that runs every hour to trigger to run `C:\upload_to_s3.bat`. But this command does not do anything - the file upload never happened.
It runs perfectly if I double click on `C:\upload_to_s3.bat`.
This is Windows 2008 Standard server. I have installed AWS CLI and configured with the command "aws configure", and entered my access key and secret key. That is why it runs if I double click the batch file.
The Windows Task Scheduler is run as "`[MyServer]/Administrator`" account.
So why doesn't the "`aws s3 sync`" command work when triggered by the task scheduler?
Do I need to add a line before "`aws s3 sync`" to set credentials first? If so, how?
Thank you!