This lab walks you through Lifecycle Policy for Cloud Storage Bucket.
You will be adding a rule to delete an Object from your bucket after a certain time.
Duration: 30 minutes
It is used to create rules like setting a Time to Live (TTL) for objects, or "downgrading" storage classes of objects to help save money.
You can add a lifecycle management configuration to a bucket. You will have to add certain conditions so once an object meets the criteria of any of the rules, Cloud Storage automatically performs a specified action on the object.
Here are some example use cases:
Adding a rule to downgrade the storage class for the objects older than 180 days to Coldline Storage.
Adding a rule for Deletion of objects created before Dec 01, 2020.
There are two types of actions that can be specified in a lifecycle rule. i.e. Delete or SetStorageClass
Delete: It deletes an object when the object meets the conditions specified in the lifecycle policy.
SetStorageClass: It changes the storage class of an object when a certain object meets the specified conditions in the lifecycle policy.
Note: Updates to your lifecycle configuration rules might take up to 24 hours to take effect which means rules may still perform actions based on the old setup for up to 24 hours.
For example, if you change an Age condition from 5 days to 7 days, any object which is 6 days older could get deleted by the Lifecycle rule because of the old configuration, might take up to 24hours to get updated.
Login into GCP Console.
Creating a bucket.
Uploading an object into your bucket.
Adding permissions for your bucket.
Adding lifecycle policy.