DEV Community

kapil kumawat
kapil kumawat

Posted on

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 -

Image description

Step 2

Goto Management page and choose Create Replication Rule option.

Step 3

Enter Replication Rule name.

Image description

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.

Image description

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.

Image description

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.

Image description

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.

Image description

Step 12

Navigate to destination AWS 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.

Image description

Conclusion

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

Top comments (0)