Introduction
Azure Blob storage is an object storage account on the cloud. You can store a massive amount of unstructured data like text, images, and videos. Blob storage is used to store binary large objects. Blob is stored in a directory structure called 'Containers'.
Why Use Blob Storage
- Blob storage is used for general purpose storage
- Blob is used to store unstructured data like audio, video, image, logs, and any type of media data from streaming, text, and binary data.
- Blob is low-cost and highly available (across multiple regions) storage.
When Not to Use Azure Blob Storage
- If you need to utilize this data for insightful purposes along these lines ensure this data can be empowered for parallelized examination (Azure Data Lake Gen2)
- You need to store social information (in this case, you should use Azure SQL Database, Azure Databases for PostgreSQL and MySQL or Azure SQL Data Warehouse)
- In the event that you need to perform advanced real-time querying (Azure Cosmos DB)
How to interact with Azure Blob Storage?
There are many services in Azure through which you can interact with Blob Storage
- AzCopy – a command-line interface to be downloaded locally. This tool can be used in windows and Linux to copy data to and from blob storage.
- Azure Data Factory- you can copy data to and from blob storage through ADF by using the account key or managed identities for Azure resources.
- Azure Databricks
- Azure SDKs (.NET, Java, Python, etc.) – allowing you to interact with Azure Storage directly within Python or R
- Azure Data Box Disk - It is used to transfer on-premises data to blob storage.
- Azure Import/Export service - It is used to import/export a large amount of data to and from your storage account using hard drives that you provide.
Resources of Blob Storage
There are three types of resource available in Blob storage
- The storage account
This storage account allows you to create a unique namespace in azure for your data. whatever data you store in this storage has its unique account name. This account name and azure storage blob endpoint form the base address of data. See below address,
http://Myfirstblobaccount.blob.core.windows.net
Where 'Myfisrtblobaccount' is a storage account name and the rest are the endpoint blob address.
- A container in the storage account
A storage account can have multiple containers and a container can store multiple blobs similar to a directory in a file system.
- A blob in the container
There are three types of blobs in azure storage,
- Block Blobs
These blobs are made up of blocks of data that can store text and binary data and can be managed individually. Maximum 4.75 TiB data can be store in block blobs.
- Append Blobs
These blobs are made up of block blobs but are optimized for append operations.
- Page Blobs
The maximum size of the file that page blob store is 8 TiB. It can store random access files, VHD files (virtual hard disk) and provide them as disks for Azure virtual machines.
Work with Blob
There are many ways to work with Blob in azure.
- Azure Portal
- Azure storage explorer
- PowerShell Script
Azure Portal
You can connect your blobs through the Azure portal. Login on Portal.azure.com. To work with blob you must have a storage account. to see, how to create a storage account you can check my previous article
Now, you need to create a 'container'. To do so, go to your storage account and open it. Now scroll down and go to the Blob service section. Here you will get the 'Container' option. Click on it. Now to create a new container, click on '+ Container' and create.
Once your container has been created go to the container and click on the upload button to upload the blob. Browse the file and select an advanced setting and then click on upload.
You can easily download and delete the block blobs from the container by selecting the check box and click on delete to check how to delete blob using Powershell script, see below link
Azure Storage Explorer
Storage Explorer is software that you can install on your machine. Login here with your Azure credentials. Now you are able to see all your storage accounts here. double click on your storage account and you will be able to see the containers, file shares, Queue, and tables, etc.
Right-click on 'Blob Container' to create a new container.
once you open the container you will get the option to upload and download the files.
Using PowerShell
Another way to work with blob is the PowerShell script. you can write a PowerShell script to connect with an azure account and create a resource group, storage account, container, etc.
PowerShell Script be like,
- #connect with azure account
- Connect-AzAccount
- #get location
- Get-AzLocation | select Location
- $location = "eastus"
- #create resource group
- $resourceGroup = "myResourceGroup"
- New-AzResourceGroup -Name $resourceGroup -Location $location
- #create storage account
- $storageAccount = New-AzStorageAccount -ResourceGroupName $resourceGroup `
- -Name "mystorageaccount" `
- -SkuName Standard_LRS `
- -Location $location `
- $ctx = $storageAccount.Context
- #create container
- $containerName = "quickstartblobs"
- New-AzStorageContainer -Name $containerName -Context $ctx -Permission blob
- # upload a file to the default account (inferred) access tier
- Set-AzStorageBlobContent -File "D:\_TestImages\Image000.jpg" `
- -Container $containerName `
- -Blob "Image001.jpg" `
- -Context $ctx
-
- # upload a file to the Hot access tier
- Set-AzStorageBlobContent -File "D:\_TestImages\Image001.jpg" `
- -Container $containerName `
- -Blob "Image001.jpg" `
- -Context $ctx
- -StandardBlobTier Hot
-
- # upload another file to the Cool access tier
- Set-AzStorageBlobContent -File "D:\_TestImages\Image002.png" `
- -Container $containerName `
- -Blob "Image002.png" `
- -Context $ctx
- -StandardBlobTier Cool
-
- # upload a file to a folder to the Archive access tier
- Set-AzStorageBlobContent -File "D:\_TestImages\foldername\Image003.jpg" `
- -Container $containerName `
- -Blob "Foldername/Image003.jpg" `
- -Context $ctx
- -StandardBlobTier Archive
Azure Blob Storage Pricing
As Azure is paid service so, when you use Blob storage, you need to pay for it. The cost breakdown for storage, data operations and data transfer. The costs of services depend of below factors,
- Region and accessibility zone of storage
- Amount of data stored
- Storage level (Premium, hot, cool, archive)
- Redundancy level (LRS, ZRS, GRS)
- Reserved storage (pay-per-use, 1 year, 3 years)
- Operations performed on the data
- Data Transfer volumes
Redundancy Options
Azure Blob Storage has five type of redundancy
- Locally Redundant storage (LRS) - provides 11 9’s (at least 99.999999999%) of durability and keeping multiple copies of data in one Azure datacenter.
- Zone-Redundant Storage (ZRS) - provides 12 9’s (at least 99.9999999999%) of durability and replicates data across multiple Availability Zones (AZ) in one region.
- Geo-Redundant Storage (GRS) - provides 16 9’s (at least 99.9999999999999%)of durability and data is stored in a one region and asynchronously replicating to secondary region.
- Read Access Geo-Redundant Storage (RA-GRS) - provides 16 9’s (at least 99.9999999999999%)of durability and replicates data to a secondary zone.
- Geo-zone redundant storage (GZRS) - combination of ZRS with GRS. Data is replicated across multiple availability zones in both first and second region. This option is only available in GPv2 storage accounts.
- Read-access geo-zone-redundant storage (RA-GZRS) - like GZRS but enables read access from either replicated region. This option is only available in GPv2 storage accounts.
Redundancy wise storage cost in Azure Blob Storage
Below are the prices for West US 2.
LRS Redundancy
Premium Tier
|
Hot Tier
|
Cool Tier
|
Archive Tier
|
$0.15 / GB
|
$0.0184 / GB (first 50TB)
$0.0177 / GB (51-500 TB)
$0.0170 / GB (500+ TB)
|
$0.01 / GB
|
$0.00099 / GB
|
ZRS Redundancy
Premium Tier
|
Hot Tier
|
Cool Tier
|
Archive Tier
|
N/A
|
$0.023 / GB (first 50TB)
$0.0221 / GB (51-500 TB)
$0.0212 / GB (500+ TB)
|
$0.0125 / GB
|
N/A
|
GRS Redundancy
Premium Tier
|
Hot Tier
|
Cool Tier
|
Archive Tier
|
N/A
|
$0.0368 / GB (first 50TB)
$0.0354 / GB (51-500 TB)
$0.0339 / GB (500+ TB)
|
$0.02 / GB
|
$0.00299 / GB
|
Redundancy wise Reserved Storage
The pricing shown is for reserving 100TB per month.
LRS Redundancy
1-YEAR RESERVED
|
3-YEAR RESERVED
|
Hot
|
Cool
|
Archive
|
Hot
|
Cool
|
Archive
|
$11,545
|
$840
|
$91
|
$1,244
|
$676
|
$84
|
ZRS Redundancy
1-YEAR RESERVED
|
3-YEAR RESERVED
|
Hot
|
Cool
|
Archive
|
Hot
|
Cool
|
Archive
|
$1,932
|
$1,050
|
N/A
|
$1,555
|
$845
|
N/A
|
GRS Redundancy
1-YEAR RESERVED
|
3-YEAR RESERVED
|
Hot
|
Cool
|
Archive
|
Hot
|
Cool
|
Archive
|
$3,090
|
$1,680
|
$273
|
$2,488
|
$1,352
|
$252
|
Data Transfer Cost
Below table shows the data transfer cost of blob storage
LRS Redundancy
DATA RETRIEVAL (per GB)
|
DATA WRITE (per GB)
|
Hot
|
Cool
|
Archive
|
Hot
|
Cool
|
Archive
|
Free
|
$0.01
|
$0.02
|
Free
|
Free
|
Free
|
ZRS Redundancy
DATA RETRIEVAL (per GB)
|
DATA WRITE (per GB)
|
Hot
|
Cool
|
Archive
|
Hot
|
Cool
|
Archive
|
N/A
|
$0.01
|
N/A
|
N/A
|
N/A
|
N/A
|
GRS Redundancy
DATA RETRIEVAL (per GB)
|
DATA WRITE (per GB)
|
Hot
|
Cool
|
Archive
|
Hot
|
Cool
|
Archive
|
Free
|
$0.01
|
$0.02
|
Free
|
$0.005
|
N/A
|