How to Copy Uploads From AWS S3 Automatically

The problem: you write files to an S3 bucket on Amazon Web services. Maybe a single user/process does this, maybe multiple users or processes do this. But you want to keep a particular process from going rogue and deleting your data. What do you do?

The answer: You write a function in AWS Lambda that is fired whenever something is uploaded to the S3 bucket in question. It then calls the copyObject() method and makes a copy of the file to another bucket--one that only it (and your admin account, presumably) have access to write to.

The GitHub repository is at:

It's a quick and dirty thing that I put together mostly as a demo of how to integrate AWS Lambda with other S3 services.

Feel free to give it a try--AWS has a free tier for all new accounts. If you like it, let me know. If you didn't like it, let me know.

5
Average: 5 (2 votes)
Your rating: None