GCP Disks

Note The gsutil program is being phased out. Look for gcloud replacements.

Throughput is determined by CPU cores, and that disk IO throughput will compete with network ingress or egress throughput as well. This means that the disk IO throughput may be slowed down by networking if the CPU cores are not sufficient (or networking IO is curtailed).

Bucket control: Access control lists (ACLs, scope and permissions) or signed URLs (limited time access tokens).

You can set lifecycle management of buckets. E.g. downgrade storage class on objects older than a year, delete objects created before a specific date, keep only the 3 most recent versions of an object.

Disk Options at GCP GCP-Disks-disc-options.png

Maximum of disks attached to VM (based on type) GCP-Disks-max-persistent-disks.png

Difference between Cloud Persistent Disk and Regular Computer Hardware Disk GCP-Disks-comparison-with-regular-disks.png

Storage/SQL Decision Chart GCP-Disks-decision-chart

To Provide Custom Encryption

Edit the gsutil configuration file .boto (generate one with gsutil config -n command if none are available).

ls -al
nano .boto

Locate the line with #encryption_key= and paste in the encryption key to be used.

# encryption_key=

Lifecycle Management

To check if the bucket has a lifecycle policy.

gsutil lifecycle get gs://$BUCKET_NAME_1

To make a new lifecycle file (in root directory of workspace).

nano life.json
      "action": {"type": "Delete"},
      "condition": {"age": 31}

Then set the policy and verify with the following commands.

gsutil lifecycle set life.json gs://$BUCKET_NAME_1
gsutil lifecycle get gs://$BUCKET_NAME_1


To check if a bucket has versioning enabled:

gsutil versioning get gs://$BUCKET_NAME_1

To activate versioning:

gsutil versioning set on gs://$BUCKET_NAME_1

To copy a file over to the bucket with versioning flag activated:

gcloud storage cp -v setup.html gs://$BUCKET_NAME_1

List all versions of a file:

gcloud storage ls -a gs://$BUCKET_NAME_1/setup.html

© Filip Niklas 2024. All poetry rights reserved. Permission is hereby granted to freely copy and use notes about programming and any code.