Prerequisites
Hardware : GCP
Google account
Retention policy is a functionality which can be used to prevent deletion or modification of the GCP bucket objects. It will delete if the specified time is finished.
Open GCP Console
Click Menu > Cloud Storage > Browser

Select one project.

Click on Retention > Set Retention Policy.

Give the retention period. You can give it in Seconds, Months, Days and Years. Click Save.

Now the retention policy is effective in the bucket.
Once the retention policy is effective if it is locked, then we can’t remove it unless the specified period is finished.

To check the retention policy, Select one file in bucket. Press delete.

The Error message will be shown as File could not be deleted.

Lifecycle
Lifecycle lets you to move your bucket’s objects into another storage if it met certain rule/ Conditions.
Click on Lifecycle > Add a rule.

Select the action you want. Click Continue.

Select the conditions which you want to give for your bucket. Click Create.

Now the Rule has been created for the bucket.
