Im trying to have a replica of my s3 bucket in a local folder. it should be updated when a change occurs on the bucket. I see many options to do it using lambda functions but im asking about the usage of s3 cli command:
aws s3 sync s3://my-bucket . --delete
which will download any files exists on the bucket, and also delete local files that exists locally but missing from the bucket (expected behavior).
Is there any problem to loop it forever with few sec of delay, like?
while true; do aws s3 sync s3://my-bucket . --delete; sleep 3s; done
Is there any limitation of the number of api calls i can do per second ? is there a better solution ?
Are you on linux? You could stick your command in a shell script and run it as a cronjob
* * * * * /path/to/your/script
^ Runs every minute
*/10 * * * * /path/to/your/script
^ Runs every 10 minutes
That would be much more reliable than a bash script in a loop.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With