0
0
GCPcloud~30 mins

Buckets and objects concept in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Buckets and objects concept
📖 Scenario: You are working on a cloud project where you need to organize files in Google Cloud Storage. You will create a storage bucket and add objects (files) to it. This is like creating a folder in your computer and putting files inside it.
🎯 Goal: Create a Google Cloud Storage bucket named my-sample-bucket and add three objects named file1.txt, file2.txt, and file3.txt to this bucket.
📋 What You'll Learn
Create a bucket named my-sample-bucket
Create a list of object names: file1.txt, file2.txt, file3.txt
Use a configuration variable to hold the bucket location as us-central1
Write code to add each object to the bucket
Add a final configuration to set the bucket's storage class to STANDARD
💡 Why This Matters
🌍 Real World
Cloud storage buckets organize and store files in the cloud, similar to folders on your computer.
💼 Career
Understanding buckets and objects is essential for managing cloud storage in roles like cloud engineer or developer.
Progress0 / 4 steps
1
Create the bucket dictionary
Create a dictionary called bucket with the key name set to the string "my-sample-bucket".
GCP
Need a hint?

Think of the bucket as a dictionary with a name key.

2
Create the list of objects and location config
Create a list called objects containing the strings "file1.txt", "file2.txt", and "file3.txt". Then create a variable called location and set it to the string "us-central1".
GCP
Need a hint?

Use a list for objects and a simple string variable for location.

3
Add objects to the bucket
Create a new key objects in the bucket dictionary and set it to an empty list. Then use a for loop with the variable obj to iterate over the objects list and append each obj to bucket["objects"].
GCP
Need a hint?

Think of adding files inside the bucket as adding items to a list inside the dictionary.

4
Set the bucket storage class
Add a new key storage_class to the bucket dictionary and set it to the string "STANDARD".
GCP
Need a hint?

Storage class is a simple key-value pair in the bucket dictionary.