🔥 The FREE Azure Developer Guide eBook is available here (opens new window).
💡 Learn more : Azure Blob Storage overview (opens new window).
📺 Watch the video : How to automatically manage Azure Blobs lifecycles (opens new window).
# How to automatically manage Azure Blobs lifecycles
# Azure Blob Storage access tiers
In Azure Blob Storage (opens new window), you pay for the storage that blobs take up and the tier that they are stored in. For instance, blobs that are stored in the Hot tier (opens new window) are the most expensive and can be accessed directly. And blobs in the Archive tier (opens new window) are the least expensive and take a while to be accessed. This tiered system is great and works well when you actively move your blobs to the appropriate tiers. Azure Blob Lifecycle management (opens new window) makes this easier by automatically moving blobs or deleting them based on rules.
In this post, we'll configure an Azure Blob Storage Lifecycle management rule in the Azure portal.
If you want to follow along, you'll need the following:
- An Azure subscription (If you don't have an Azure subscription, create a free account (opens new window) before you begin)
- A General Purpose v2 Azure Storage Account (opens new window)
# Create a Blob Lifecycle management rule
Let's create a rule for Azure Blobs to move to the Cool storage access tier when they aren't modified for 20 days.
- Go to the Azure portal (opens new window)
- Navigate to the Azure Storage account
- In the Blob service section of the menu, select Lifecycle management
(Lifecycle management menu in the Azure portal)
- Create a new rule by clicking on the Add rule button
- In the Details tab:
- Put in a name for the rule
- Select Limit blobs with filters
- Select Base blobs for Blob subtype
- Select Next
(Create a Lifecycle rule, details tab in the Azure portal)
- On the Base blobs tab:
- Put "20" in the More than (days ago) field
- Select Move to cool storage
- Select Next
(Create a Lifecycle rule, base blobs tab in the Azure portal)
- In the Filter set tab, put in \logs to indicate that this rule only applies to the "logs" container
(Create a Lifecycle rule, filter set tab in the Azure portal)
- Select Add to create the rule
Now, all blobs in the logs container that aren't modified for 20 days, will automatically be moved to cool storage.
(Lifecycle management rule in the Azure portal)
Azure Blob Storage (opens new window) access tiers (opens new window) are great to reduce your storage costs. And now, with Azure Blob Storage Lifecycle management (opens new window), you can automatically move blobs to their appropriate access tier, based on their usage. Go and check it out!