[Django]-Migrating from Amazon S3 to Azure Storage (Django web app)

2👍

Per my experience, you can do the two steps for migrating from Amazon S3 to Azure Storage for Django web app.

The first step is moving all files from S3 to Azure Blob Storage. There are two ways you can try.

  1. Using the tools for S3 and Azure Storage to move files from S3 to local directory to Azure Blob Storage.

These tools below for S3 can help moving files to local directory.

For moving local files to Azure Blob Storage, you can use AzCopy Command-Line Utility for high-performance uploading, downloading, and copying data to and from Microsoft Azure Blob, File, and Table storage, please refer to the document https://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy/.

Example: AzCopy /Source:C:\myfolder /Dest:https://myaccount.blob.core.windows.net/mycontainer

  1. Migrating by programming with Amazon S3 and Azure Blob Storage APIs in your familiar language like Python, Java, etc. Please refer to their API usage docs https://azure.microsoft.com/en-us/documentation/articles/storage-python-how-to-use-blob-storage/ and http://docs.aws.amazon.com/AmazonS3/latest/API/APIRest.html.

The second step is following the document http://django-storages.readthedocs.org/en/latest/backends/azure.html to re-configure Django settings.py file. Django-storages would allow any uploads you do to be automatically stored in your storage container.

DEFAULT_FILE_STORAGE='storages.backends.azure_storage.AzureStorage'
AZURE_ACCOUNT_NAME='myaccount'
AZURE_ACCOUNT_KEY='account_key'
AZURE_CONTAINER='mycontainer'

You can find these settings on Azure Portal as @neolursa said.


Edit:
On Azure old portal:
enter image description here

On Azure new portal:
enter image description here

1👍

The link you’ve shared has the configuration for Django to Azure Blobs. Now when I did this all I had to do is to go to the Azure portal. Under the storage account, get the access keys as below. Then create a container and give the container name to Django configuration. This should be enough. However I’ve done this a while ago.

For the second part, migrating the current files from S3 bucket to BLOB, there a couple of tools you can use;

If you are using visual studio, you can find the blobs under the Server Explorer after entering your azure account credentials in Visual Studio.

Alternatively you can use third party tools like Azure Storage Explorer or Cloudberry explorer.

Hope this helps!

enter image description here

Leave a comment