Migrating Limited Objects With Pre-Defined Prefix Using S3 Batch Replication

In my previous article, we learned about replicating existing objects between different AWS S3 buckets using S3 Batch Replication. 

Replicate Existing Objects Using AWS S3 Batch Replication

In this article, we will learn how to migrate limited objects with a pre-defined prefix using S3 Batch Replication which can be done at the time of configuring the replication rule.

Taking a use case where I don't want to replicate all objects from existing S3 source bucket to new target bucket but need certain files with specific names only, that is also now possible with the new update of AWS S3 replication of existing objects.

How to get started

Step 1

From the AWS S3 source bucket, you like to migrate objects starting with name ‘house’ as shown below -

Step 2

Goto Management page and choose Create Replication Rule option.

Step 3

Enter Replication Rule name.

Step 4

Choose option ‘Limit the scope of this rule using one or more filters’.

Step 5

In the Prefix option, write the prefix value ‘house’ to limit the scope.

Step 6

Choose your destination bucket from S3 bucket list. You can replicate objects across different AWS Regions as Cross-Region Replication or can replicate in the same AWS Region as Same-Region Replication.

Step 7

Choose an IAM role. With default setting AWS S3 creates a new IAM role with sufficient permission to complete this task. I chose my existing IAM role which I used earlier for replication.

Step 8

Once you click on Save, a Batch Operation window will appear showing all details that you configured in previous steps. 

Step 9

In Status, you will be asked for your confirmation to run this job.

Step 10

Click on Run Job button.

Step 11

Now the job will be in running state and you will see status as Completed once replication job is completed.

Step 12

Navigate to destination S3 bucket and you will get files with specified prefix only.

In my case, I use the prefix ‘house’ and can only see those objects after replication.

Conclusion

Using S3 Batch replication we can also replicate a specific set of objects using the prefix option in configuring the replication rule.


Similar Articles