Automatic sync S3 to local

Viewed 1004

I want to auto sync my local folder with S3 bucket. I mean, when i change some file in S3, automatically this file would update in the local folder. I tried using scheduler task and AWS cli but i think there is a better way to do that. Do you know some app or better solution?

Hope you can help me.

2 Answers

@mgg, You can mount the s3 bucket to the local server using s3fs, this way you can sync your local changes to s3 bucket.

You could execute code (Lambda Functions) that responds to some events in a given bucket (such file change, deleted or created), so, you could have a simple http service that receives a post or a get request from that lambda and update your local data accordingly.

Read more:

Tutorial, Using AWS Lambda with Amazon S3

Working with Lambda Functions

The other approach (I don't recommend this) is to have some code "pulling" for changes in some bucket and then reflecting those changes locally. At first glance it looks easier to implement, but ... it get complicated when you try to handle not just creation events.

And of course for each cycle of your "pulling" component you have to check all elements in your local directory against all elements in the bucket, it is a performance killing approach!

Related