In this blog, We will explore how to easily perform object replication between storage accounts in the same or different regions or different subscriptions. This decreases the read latency from applications, users or any workload that requires reading files from a different region.
The identical sets of block blobs can be processed by computing workloads in many regions with object replication.Data can be processed or analysed in one location, and then the outcomes can be replicated to other regions. You can lower expenses by archiving your data once it has been replicated.
- Requires source and destination accounts
- Require versioning and change feed enabled.
- Support cross tenant replication
Let’s say we have a source storage account in East US region with source container that has blobs that are block blobs that are being used by workload or users that are close to the East US region.
For example, we need a solution that is using blobs from a source storage account in a different azure region. Well, because those resources are in different Azure region that are accessing these blobs exists further away,they are going to experience latency.Which we can use object replication to solve the problem.
To perform that we can enable versioning and blob change feed on the source storage account to keep track of the versions of block blobs .Then we can create destination storage account like in West US region closer to those users that will be using data here that we have inside our blobs, and we can enable versioning on this. And now whenever we do this we can create a replication policy that will allow us to perform those asynchronous copy operations from source storage account to destination accounts.
Refer image provided in Microsoft documentation:
Let’s do it in action.
Step-1 – Create a storage account .
Step-2 Enable versioning and change feed under data protection tab. To keep track of create and delete modifications inside storage account.
Step-2 Create destination storage account .
Step-3 Enable only versioning on destination storage account. we don’t need to enable change feed on destination storage account.
Note- By default allow across tenant replication feature is enabled. If your security policies require that you restrict object replication to storage accounts that reside within the same tenant only, you can disallow the creation of policies where the source and destination accounts are in different tenants.
Step 4– Let’s create source container.After enabling versioning and change feed. Change feed container will be created to keep track of modified changes in source storage account.
Step-5– Let’s create destination container.
Now we have two different regions source and destination storage account.
Step 6– Now we need to setup object replication policy in source storage account.
Step 7– Select resource group, source, destination storage account and prefix filters (A prefix match will find items like folders and blobs under the specified container.)
Step 8– Choose option for copy over options everything (to copy all objects) ,only new objects (to copy new files or modifications only),custom (from any particular date range)
Step 9– Now lets upload some files in source container blob.
Now let’s upload file with prefix (folder) from advance options.
Step 10 – Now in destination container folder will be copied with prefix. Blob change feed in source storage account will detect changes and replicate over to destination storage account.
Note – Only prefix folder will be copied because in replication rule we have mentioned in the filters.