Dive deep into GCP Storage Classes with Handson Tutorial. Discover how each storage class can impact your data’s availability, cost, and performance. Whether you’re dealing with hot, cold, or archival data, learn how to select the right storage class for your needs, configure lifecycle management rules, and optimize your cloud storage costs.
Table of Contents
GCP Storage Classes Types
Storage classes are type of metadata associated with every storage object. The type of storage class affects object’s availability and pricing.
Storage type | Description | Best Suited For |
Standard Storage | Storage for data that is frequently accessed (“hot” data) and/or stored for only brief periods of time. | “Hot” data, including websites, streaming videos, and mobile apps. |
Nearline Storage | Low cost, highly durable storage service for storing infrequently accessed data. | Data that can be stored for 30 days. |
ColdLine Storage | A very low cost, highly durable storage service for storing infrequently accessed data. | Data that can be stored for 90 days |
Archival Storage | The lowest cost, highly durable storage service for data archiving, online backup, and disaster recovery. | Data that can be stored for 365 days. |
How to Configure Set Storage class Rule for object life cycle
To optimize cloud storage cost following points needs to be consider.
- Downgrading storage cost of objects which are not used frequently.
- Deleting old/archive data periodically
- Managing non concurrent versions of object
Google Cloud Storage Life Cycle Management automates this process by applying actions and setting rules at storage bucket level.
If you are new to cloud storage buckets refer our article here, Google Cloud Storage Free – Google Cloud Tutorials .
To use object life cycle management in Google cloud you need to define life cycle management at configuration at bucket level. This can be defined at the time of bucket creation or can be modified later.
The configuration contains sets of rules which are applied to existing and future objects inside bucket. When object meets the set criteria google storage performs the specified action.
A lifecycle rule can specify one of the following actions:
- Delete: The
Delete
action deletes an object when the object meets all conditions specified in the lifecycle rule.
Exceptions: If the bucket has object versioning enabled deleting the live version causes it to become non concurrent version. If non concurrent version is deleted, it will be deleted permanently.
The delete action will not affect if the object that has retention policy configured.
- Set Storage Class: The
SetStorageClass
action changes the storage of an object and updates the object’s modification time when the object meets all conditions specified in the lifecycle rule.
An object has to match all of the conditions specified in a rule for the action in the rule to be taken.
If object has multiple rules specified and one or more conditions are met simultaneously than cloud storage performs action associated with only one of the rules, based on the following considerations:
The Delete
action takes precedence over any SetStorageClass
action.
The SetstorageClass action that downgrades the object’s storage class to lowest price always takes precedence.
Example:
- Rule 1 – Change Object Storage class to Nearline Storage
- Rule 2- Change object storage class to Coldline Storage
If both rules use the exact same condition, the object’s class always changes to Coldline storage when the condition is met.
It might take up to 24 hours to reflect changes made to bucket’s lifecycle configuration and Object Lifecycle Management might still perform actions based on the old configuration during this time.
Example:
if you change an age
condition from 10 days to 20 days, an object that is 11 days old could be deleted by Object Lifecycle Management up to 24 hours later, due to the criteria of the old configuration.
Google Cloud Storage Life Cycle Management Conditions
An object has to meet one or more conditions from below list for an action to take place.
- Age – This condition is satisfied when the object reaches the specified age in days from its created date.
createdBefore
– This condition is satisfied when the object is created before the date specified in UTC.customTimeBefore
– This condition is satisfied when the date portion of on object is earlier than the date specified.daysSinceCustomTime
– This condition is satisfied when specified number of days has passed since the date and time specified in custom time metadate field. To know more about object metadata refer Learn Google Cloud Storage Metadata In 3 Minutes – Google Cloud Tutorials.-
daysSinceNoncurrentTime
– This condition is used in conjunction with object versioning is enabled on the storage bucket. It is satisfied when the specified number of days have passed since the object became noncurrent due to live version was deleted or replaced. Check object versioning cost here Pricing | Cloud Storage | Google Cloud isLive
– This condition is used in conjunction with object versioning is enabled on the storage bucket. When it is set to false all non-concurrent versions of objects satisfy this condition. When set to true this condition is satisfied by live version of the object.matchesStorageClass
– This condition is satisfied when the object in the bucket matches with the specified storage class.noncurrentTimeBefore
– This condition is used in conjunction with object versioning is enabled on the storage bucket. It is satisfied for the objects that became noncurrent on a date prior to the one specified in this condition.numNewerVersions
– This condition is used in conjunction with object versioning is enabled on the storage bucket. If value for this condition is set to ‘N’, an object will satisfy this condition if it has at least N versions including live version newer than it.matchesPrefix
andmatchesSuffix
– This condition is satisfied when object name has case sensitive match with the specified prefix and suffix.
SetStorageClass
Action supports the following storage class transitions:
Original storage class | New storage class |
---|---|
Standard storage, Multi-Regional storage, or Regional storage | Nearline storage Coldline storage Archive storage |
Nearline storage | Coldline storage Archive storage |
Coldline storage | Archive storage |
Open storage bucket, navigate to Lifecycle tab and click on Add Rule to configure new Rule. Select action “Set storage class Nearline.”.
Configure condition and set condition for age to 60. Click on create rule. This rule will apply the action to current and future objects when objects ages > 60 days in this bucket.
How to Configure Delete Rule for object life cycle
Open storage bucket, navigate to Lifecycle tab and click on Add Rule to configure new Rule. Select action “Delete Object”.
Configure condition and set created before date to 31 Dec 2022. Click on create rule. This rule will apply the action to current and future objects. All objects that were uploaded to this bucket before 31 Dec 2022 would be deleted.
FAQ
Does Google Cloud Platform provide application lifecycle management?
Yes,GCP supports object cycle management to downgrade an object storage class to lower pricing, to retain non concurrent object version or to define TTL (time to live) for an object.
Is Google Cloud Storage an object storage?
yes,GCP provides cloud storage as a managed service to store and retrieve any kind and amount of data.