The requirement is we store the documents in s3 buckets. Client needs backup in the specific interval so take it to the filesystem or s3 or azure or any other place and give it back to restore back sometimes. The versioning is enabled in the s3 bucket so we are fetching documents based on VersionId. If we need to restore back the documents which they give as a filesystem they don't have VersionId so in DB we can't map the documents.
How to copy all documents from one bucket to another bucket with renaming objects in the destination bucket as version id of the source bucket?
We tried it using AWS CLI, APIs and SDK but this doesn't work well for millions of objects. I got to know about S3 batch replication, so need to know how to do using S3 batch replication or any other way.
I have used Batch Operation which invokes the lambda function, I have created a manifest file of documents that need to be copied, the manifest file is a CSV file containing bucket name, object key, versionID. The Lambda function which copies the document to destination bucket with name change as version ID.
Lambda function is as follows