Skip to main content

Azure Storage Synchronization between Azure Regions from China and the rest of them

Working with Azure Regions from China is sometimes a little bit more complicated. One of the issues that I encountered is the ability to sync content between different Azure Regions. Inside Azure regions that are in China, things go very smooth.
The challenge appears in the moment when you need to handle data synchronisation between a region from China and a one from Europe, for example. I had this case between China East 2 and North Europe. There is no out of the box, the mechanism to do something like that and you need to handle this synchronisation by yourself.
We will take a look at two different scenarios. A simple one, where is less automation, but the investment is lower, and in 10 minutes you have the sync mechanism in place. The second one is a little more complex, but can be used with success for recurrent activities.

Simple Use Case
For simple scenarios, you should not start to write code by yourself. Take a look at AzCopy that is a command-line tool that enables us to copy content from local machines to Azure Storage or from one Azure Storage to another.
Using Azure Copy, we can run a command line that copy content from one container to another. You can specify what policy you want to use at the moment when content blobs with the same name already exist.
.\azcopy copy 
    'https://rvdemo.blob.core.windows.net/demo/all/*?sv=2019-02-02&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-11-09T21:22:50Z&st=2019-10-30T13:22:50Z&spr=https&sig=9IxJn%2BRYgaBu5R%dsds2BG%2Frf4spjNBxYXagNu7BVx1PT1eTk%1D' 
    'https://rvdemoch.blob.core.chinacloudapi.cn /demo/copy' 
    --overwrite false
In the above example, we just copied content from one location from North Europe to a storage account from China. Don’t forget that the blobs that it is used as a source should be public or you should also include de SAS key (as I have done in the example). By default the overwrite is set to true, meaning that if you already the same content in the destination location, the content is overwritten.
I’ve also done some performance test to see how long it takes to copy content from one location to another. You can see below the output of it.

North Europe     10GB     send to East China           1h52m                  100% success rate             
Japan West         10GB     send to East China           1h01m                  100% success rate
East China           1GB        send to North Europe     0h21m                  100& success rate
East China           1GB        send to Japan West         0h16m                  100& success rate

Automation
For scenarios where you need to be able to repeat the process over and over again, and you want to have better control, I would use Azure Data Factory. It is allowing us to define a pipeline where we would have a copy activity from one Azure Blob to another one. The tricky part here is how to specify the storage from another subscription. Because in Azure Regions location in China you will use a different account and a separate subscription, you are not able to use the Copy Data Tool available inside the Azure Data Factory.
The good part is that we have a connector inside Data Factory that can use a SAS for Azure Blob Storage. The approach would be to run in North Europe the Data Factory Pipeline that would pus the content to the East China location by using the SAS key for access and authorisation.

{
    "name": "AzureBlobStorageLinkedService",
    "properties": {
        "type": "AzureBlobStorage",
        "typeProperties": {
            "sasUri": {
                "type": "SecureString",
                "value": "https://rvdemo.blob.core.windows.net/demo/all/*?sv=2019-02-02&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-11-09T21:22:50Z&st=2019-10-30T13:22:50Z&spr=https&sig=9IxJn%2BRYgaBu5R%dsds2BG%2Frf4spjNBxYXagNu7BVx1PT1eTk%1D'"
            }
        },
        "connectVia": {
            "referenceName": "Linked.....",
            "type": "IntegrationRuntimeReference"
        }
    }
}

To sum up
We can imagine different solutions, using Azure Functions, Azure VMs or Azure Batch, but these two solutions are the one that I used. The first one, based on AzCopy, is simple and can be used with success for a PoC or for cases you you need to move binary content. The one based on Azure Data Factory works with success when you need to do heavy data sync between the two locations.

Comments

Popular posts from this blog

Windows Docker Containers can make WIN32 API calls, use COM and ASP.NET WebForms

After the last post , I received two interesting questions related to Docker and Windows. People were interested if we do Win32 API calls from a Docker container and if there is support for COM. WIN32 Support To test calls to WIN32 API, let’s try to populate SYSTEM_INFO class. [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO { public uint dwOemId; public uint dwPageSize; public uint lpMinimumApplicationAddress; public uint lpMaximumApplicationAddress; public uint dwActiveProcessorMask; public uint dwNumberOfProcessors; public uint dwProcessorType; public uint dwAllocationGranularity; public uint dwProcessorLevel; public uint dwProcessorRevision; } ... [DllImport("kernel32")] static extern void GetSystemInfo(ref SYSTEM_INFO pSI); ... SYSTEM_INFO pSI = new SYSTEM_INFO(...

How to audit an Azure Cosmos DB

In this post, we will talk about how we can audit an Azure Cosmos DB database. Before jumping into the problem let us define the business requirement: As an Administrator I want to be able to audit all changes that were done to specific collection inside my Azure Cosmos DB. The requirement is simple, but can be a little tricky to implement fully. First of all when you are using Azure Cosmos DB or any other storage solution there are 99% odds that you’ll have more than one system that writes data to it. This means that you have or not have control on the systems that are doing any create/update/delete operations. Solution 1: Diagnostic Logs Cosmos DB allows us activate diagnostics logs and stream the output a storage account for achieving to other systems like Event Hub or Log Analytics. This would allow us to have information related to who, when, what, response code and how the access operation to our Cosmos DB was done. Beside this there is a field that specifies what was th...

Cloud Myths: Cloud is Cheaper (Pill 1 of 5 / Cloud Pills)

Cloud Myths: Cloud is Cheaper (Pill 1 of 5 / Cloud Pills) The idea that moving to the cloud reduces the costs is a common misconception. The cloud infrastructure provides flexibility, scalability, and better CAPEX, but it does not guarantee lower costs without proper optimisation and management of the cloud services and infrastructure. Idle and unused resources, overprovisioning, oversize databases, and unnecessary data transfer can increase running costs. The regional pricing mode, multi-cloud complexity, and cost variety add extra complexity to the cost function. Cloud adoption without a cost governance strategy can result in unexpected expenses. Improper usage, combined with a pay-as-you-go model, can result in a nightmare for business stakeholders who cannot track and manage the monthly costs. Cloud-native services such as AI services, managed databases, and analytics platforms are powerful, provide out-of-the-shelve capabilities, and increase business agility and innovation. H...