I want to run below command at my EC2 startup. This is an ubuntu 18.04 box. I have tried crontab (@reboot), User data startup script as per article User Data. I can see that command is being run in both cases (I create a output log file), but actually it does not complete sync. If I run manually this command in terminal this works perfectly fine.
aws s3 sync s3://mybucket s3://mybucket2
Yes I tried reboot and that aws link script as well. See below file structure and crontab expression. s3sync.log is empty one. Looks like cron run but it do not complete the command. or something else
-rw-rw-r-- 1 ubuntu ubuntu 0 Jun 16 14:55 s3sync.log
-rwxrwxr-x 1 ubuntu ubuntu 58 Jun 16 14:44 s3sync.sh
@reboot sh /home/ubuntu/s3sync.sh > /home/ubuntu/s3sync.log
Content of s3sync.sh
aws s3 sync s3://mybucket s3://mybucket2