0
0
GCPcloud~30 mins

Why Cloud Storage matters for object data in GCP - See It in Action

Choose your learning style9 modes available
Why Cloud Storage matters for object data
📖 Scenario: You work for a small company that wants to store and manage photos and videos from customers. These files are large and come in many formats. You need a simple, reliable way to keep these files safe and easy to access from anywhere.
🎯 Goal: Build a basic Google Cloud Storage setup that organizes object data into buckets and sets access permissions. This will help the company store and manage their files securely and efficiently.
📋 What You'll Learn
Create a Cloud Storage bucket named exactly customer-media-bucket
Set a location for the bucket as US
Define a variable storage_class with the value STANDARD
Use the storage_class variable when creating the bucket
Add a lifecycle rule to delete objects older than 365 days
Enable uniform bucket-level access for security
💡 Why This Matters
🌍 Real World
Cloud Storage is used by companies to store large files like photos, videos, backups, and logs. It makes data accessible from anywhere and protects it with security and lifecycle rules.
💼 Career
Knowing how to configure Cloud Storage buckets is essential for cloud engineers and developers managing data storage, backups, and compliance in cloud environments.
Progress0 / 4 steps
1
Create the Cloud Storage bucket
Write code to create a Cloud Storage bucket named customer-media-bucket in the US location. Use the Google Cloud Python client library and assign the bucket to a variable called bucket.
GCP
Need a hint?

Use client.bucket('customer-media-bucket') to create the bucket object and set bucket.location = 'US'.

2
Define the storage class variable
Create a variable called storage_class and set it to the string 'STANDARD'. This will specify the storage class for the bucket.
GCP
Need a hint?

Just assign the string 'STANDARD' to the variable storage_class.

3
Set the storage class and lifecycle rule
Set the bucket's storage_class property using the storage_class variable. Then add a lifecycle rule to delete objects older than 365 days by appending a dictionary with action and condition keys to bucket.lifecycle_rules.
GCP
Need a hint?

Assign storage_class to bucket.storage_class. Then add a lifecycle rule dictionary to bucket.lifecycle_rules with action type 'Delete' and condition age 365.

4
Enable uniform bucket-level access and create the bucket
Set bucket.iam_configuration.uniform_bucket_level_access.enabled to true to improve security. Then call bucket.create() to create the bucket in Google Cloud Storage.
GCP
Need a hint?

Set bucket.iam_configuration.uniform_bucket_level_access.enabled = True and then call bucket.create().