Optimizing cost with Google Cloud Storage
In this lab, you use Cloud Functions and Cloud Scheduler to identify and clean up wasted cloud resources. You trigger a Cloud Function to migrate a storage bucket from a Stackdriver Monitoring alerting policy to a less expensive storage class.
GCP provides storage object lifecycle rules that automatically moves objects to different storage classes based on a set of attributes, such as their creation date or live state. However, these rules can’t take into account whether the objects have been accessed. Sometimes, you might want to move newer objects to Nearline storage if they haven’t been accessed for a certain period of time.
What you'll do
Create two storage buckets, add a file to the
serving-bucket, and generate traffic against it.
Create a Stackdriver Monitoring dashboard to visualize bucket utilization.
Deploy a Cloud Function to migrate the idle bucket to a less expensive storage class, and trigger the function by using a payload intended to mock a notification received from a Stackdriver alerting policy.
Join Qwiklabs to read the rest of this lab...and more!
- Get temporary access to the Google Cloud Console.
- Over 200 labs from beginner to advanced levels.
- Bite-sized so you can learn at your own pace.
Enable the Cloud Scheduler API
Create a Cloud Storage bucket
Make bucket public
Create another cloud storage bucket
Deploy cloud function
Confirm the migration of bucket to Nearline.