GCP Classroom Series – 03/Apr/2021

GCS Operations

  • In GCS operations are categorized into two

    • Class A Opertions: Object adds, bucket add and object listings
    • Class B Operations: Object gets, retrieving buckets and object metadata Preview
  • As we change object storage classes the pricing will vary

    • Refer storage costs and operation costs Preview Preview
  • When we upload some documents/objects into GCS bucket they might be accessed frequently but after some time these documents/objects access frequency will be reduced

  • When the object is accessed frequently we want the storage class to be standard

  • But as objects become infrequently accessible we would like to have the storage class to nearline or coldline where we can save on storage costs

  • The solution for this is to use Object Lifecycle policies

Object Lifecycle policy

  • This allows us to specify how long object should exist under same settings in your bucket
  • Navigate to storage browser and select the bucket Preview Preview Preview Preview Preview
  • We can set the lifecylce rule using json file Refer Here
  • Lets build a json file for lifecycle config
{
    "lifecycle": {
        "rule": [
            {
                "action" : {
                    "type": "SetStorageClass",
                    "storageClass": "NEARLINE"
                },
                "condition": {
                    "age" : 90
                }
            }
        ]
    }
}

Preview Preview

Deleting objects using gsutil

  • the command would be
gsutil rm gs://bucketname/objectname

Preview

  • to delete all the objects recursively
gsutil rm -r gs://<bucketname>
  • To delete the bucket
gsutil rb gs://bucketname

Managing permissions in the bucket

Preview Preview

Mounting gcs using gcsfuse

  • Filesystem in Userspace (FUSE), cloudstorage is an opensource FUSE adoption fucntionality provided by GCS
  • Refer Here for the installation of gcs fuse on linux system Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin