Follow us

S3 Batch Replication

S3 batch replication feature, help you to replicate your existing S3 objects and keep always synchronize your buckets with new objects across all the buckets you configured for replication between or different regions or different AWS accounts.

(Before this as on 08Feb2022), S3 replication was only work for new object to replicate but not by default for existing object and to replicate existing object, you had to raise request to AWS support and then AWS support enable this feature for you and also the replication for existing object was taking more time as compare to replicate new object. But with new batch replication feature, now you can simply go and do setup and replicate your existing objects and keep

always synchronize your buckets for new objects.

Use cases: For example, you can use it to minimize latency by maintaining copies of your data in AWS Regions geographically closer to your users, to meet compliance and data sovereignty requirements, and to create additional resiliency for disaster recovery planning. S3 Replication is a fully managed, low-cost feature that replicates newly uploaded objects between buckets. The buckets can belong to the same or different accounts. Objects may be replicated to a single destination bucket or to multiple destination buckets.

 

Demo:

 

Make sure you have versioning enabled for source and target buckets to use S3 Batch replication feature.

To create replication, go to source S3 bucket and them from there you can "create replication rule" from "Management" tab or you can use "Batch Operations" option from left panel.

Amazon S3 
Buckets 
Access Points 
Object Lambda Alcess Points 
Multi-Region Access Points 
Batch Opera tions 
Access analyzer for SS 
glock Public Alcess settings for 
this account 
Storage Lens 
Dashboards 
Organizations settings 
Feature spotlight O 
• Marketplace for S3 
rep-source-test-bu 
rep-source-test-bucket-I 
Objects 
Properties 
Permissions 
Management 
Access Points 
Lifecycle rules ( 
Use lifecycle to want Amm S3 to take during an o*ts to them. 
C 
View details 
rule name 
Replication rules (1 
version 
actions 
Create lifecycle rule 
Expired object 
Noncurrent 
delete 
versions actions 
No lifecycle rules 
There are no lifecycle rules for this bucket 
Create lifecycle rule 
use defme '—n SS to apply duting such repliQ —hip. to 
C 
Actions 
Destination 
Region 
uS East (Ohio) 
us-east-2 
Create replication rule 
Priority 
Scope 
Entire 
O 
Replication 
rule name 
Replicate 
Destination 
bucket 
sß//rcp-target- 
test-b o- I 
Storage 
Same as 
source

 

Once you create, it will ask you to provide target buckets and there you can select bucket form same or different region or even use different AWS account S3 bucket as target S3 to get objects copied/replicated from source bucket to target bucket.

You can also specify any prefix/filter you want to use for data copy or all objects to be copied.

Source bucket name 
Source Region 
US East Virginia) 
a scope 
O Limit of this 
C) Apply to int 
Filter type 
Add 
the 
Add tag 
Destination 
objece 
the 
o 
a in this 
C) Specify a in 
Bucket w e 
will 
ing one or more 
bucket 
in Aws 
rule in

 

During replication rule creation, you can also change storage class for your target bucket:

Destination storage class 
af-fe„. far 
Change storage 
Storage class 
Availability 
Standard 
Standard-IA 
Designed for 
data than 
with 
Data with ctmging unknm 
data 
(once a 
with 
Reaeatable. infrequently data 
SC days

 

For IAM role,

Make sure you have required permission available to list/save objects from source to target bucket and also with role, trusted assume role must be used for s3:

Permission:

emen 
"Action": 
"53: ListSucket", 
"53 : GetObjectVersionForRepIication" , 
"53: GetObjectVersionAcI", 
" : GetObjectVersionTagging" , 
"53: GetObjectRetention" , 
GetObjectLegaIHoId" 
"Effect": ' 
"Resource" : 
3' : :rep-source-test-bucket-l", 
:rep- source-test-bucket-I/ * 
s 3' •:rep-terget-test-bucket-ohio-l", 
"Action": 
"53: Replicateobject" 
"53: Replicateoelete" 
"53: ReplicateTags", 
" s 3 : ObjectChwneOaerrideToSucketOaner" 
"Effect": ' 
"Resource" :

Trusted - Assume role:

Permissions 
Trust relationships 
Tags 
Trusted entities 
Entities that can assume this role under specified conditions. 
"Version : 
" ' 2a12-1a-17", 
"Statement" : 
"Effect": "Allow", 
"Principal" • 
"Service" • 
" 53. amazonaws . com" 
"Action": "Sts : AssumeRoIe"

 

During role creation, at last step, it will ask you to confirm, do you want to replicate existing object, choose - yes.

Replicate existing objects? 
x 
You can enable a one-time Batch Operations job from this replication configuration to 
replicate objects that already exist in the bucket and to synchronize the source and 
destination buckets. Learn more or see pricing 
Existing objects 
o 
No, do not replicate existing objects. 
O Yes, replicate existing objects. 
Cancel 
Submit

 

When you choose yes, then it will ask some more details like how you want to run, logging bucket where you want to generate report and also generate template json file which is actually like S3 inventory which keep track of your existing objects to copied and need additional IAM role with permission to have put permission for logging bucket and list permissions to manage inventory:

Amazon S3 
points 
points 
Multi-Region Points 
Batch Operatims 
for SS 
Block fo 
this 
AWS 
option 
the is thejab the 
O thejob when its 
When 
Completion report 
using L 
completion 
C) Failed only 
to 
appended 
Permissions 
(3 Wait run the job when its 
add a in 
N.vS Ma 
r ketplaæ S3 
an the An jab 
far IAM 
View policy and 
(3 ARN 
IAM role

IAM role permission:

"Version : 
" "2a12-1ø-17", 
"Statement" • 
"Effect": ' 
"Action": 
"53 : GetRepIicationConfiguration" 
" : PutlnventoyConf iguration " 
"Resource" : 
3' :rep-source-test-bucket-l", 
"Effect": ' 
"Action": "s3:PutObject" 
"Resource" : 
3 • : rep-target-test-bucket-1/*'

IAM role trust relationship - Assume role:

Permissions 
Trust relationships 
Tags 
Access Advisor 
Trusted entities 
Entities that can assume this role under specified conditions. 
"Version : 
" ' 2a12-1a-17", 
"Statement" : 
"Effect": "Allow", 
"Principal" • 
"Service" • "batchoperations . 53 . amazonaws . com" 
"Action": "Sts : AssumeRoIe"

 

 

And then once it created, you can find same either with S3 replication management tab rule section or from bath operation:

Amazon S3 
Access Points 
Object Lambda Access Points 
Multi-Region Access Points 
Batch Operations 
Access analyzer for SS 
Public Access settings for 
this n t 
Storage Lens 
Dashboards 
AWS Organizations settings 
x 
Amazon SS ) Batch Operations 
Batch Operations 
A job is used to execute batch operations on a list of S3 objects. The list of SS objects 6 con 
confirmed. the job status update to Awa't,'ng confirmation to run. and must Ru 
Jobs (3) 
Q by job ID or description 
Job 
sf27896.t- 
Completed 
a42dc2d3.ta 
2022-02-10- 
Replicate 
Replicate

And you can use the clickable link to check status or execution also you can verify the bucket you had provided for storing all the execution result like below:

job-5f27896c-3aae-49bc-afae-a42dc2d34419/ 
Objects( ) 
C 
O Copy S3 um 
O Copy URL 
Ond objects by prefix

 

So in my case: with my source bucket I had few files including folders and after replication created, it copied all the objects to my target bucket. And also after replication done for my existing object(highlighted in yellow), I uploaded one new file to my source object (non highlighted one) and same have been copied to my target bucket just in few seconds.

 

My source bucket:

rep-source-test-bucket-I 
Objects( ) 
C 
C pyS3 um 
Ond objects by prefix 
1 - togy.txt 
d t_txt

 

My target bucket:

Am mn S3 ) 
rep-target-test-bucket-ohio-l 
Objects( ) 
C 
C pyS3 um 
Ond objects by prefix 
O Shi

Categories/Tags: s3~s3 replication~s3 batch replication

Recent Articles

1

AWS Saving Plan - Cost optimization tips

2
3

AWS RDS Key Concepts & Why you should use it?

4
5

Open-Search/Kibana - Multi Tenancy Setup

See All Articles