GCP PlayCloud Labs
-
GCP PlayCloud Labs
-
Guided Lab: How to Launch a GCP Compute Engine Linux Instance
-
Guided Lab: Creating a VM Using Instance Templates
-
Guided Lab: Creating and Managing Instance Groups in Compute Engine
-
Guided Lab: Creating a Spot VM Instance
-
Guided Lab: Configuring Shielded VM Options
-
Guided Lab: Exploring Instance Metadata in Google Cloud
-
Guided Lab: Vertically Scaling a VM Instance
-
Guided Lab: Setting up a Web Server on a VM Instance
-
Guided Lab: Using Startup Scripts in GCP VM Instances
-
Guided Lab: Creating a Custom Image from a VM Instance with Web Server in Google Cloud
-
Guided Lab: Creating VM Snapshots and Restoring a VM from a Snapshot
-
Guided Lab: Setting Up and Managing a Database on a VM Instance
-
Guided Lab: Installing WordPress on an Ubuntu VM Instance with LEMP Stack
-
Guided Lab: Deploying a LAMP Stack on a Compute Engine VM
-
Guided Lab: Reserving or Promoting a Static IP Address for a VM Instance
-
Guided Lab: SSH Access to GCP VM Instance from Local Machine using SSH Key Pair
-
Guided Lab: Guarding Your VM with Deletion Protection
-
Guided Lab: Setting Up a Linux Bastion Host on GCP
-
Guided Lab: Creating a Cloud Storage Bucket
-
Guided Lab: Uploading, Organizing, and Managing Objects in Cloud Storage
-
Guided Lab: Exploring Google Cloud Storage Classes
-
Guided Lab: Hosting a Static Website in Google Cloud Storage Bucket
-
Guided Lab: Protecting Data on Cloud Storage Bucket Against Accidental Delete and Overwrite Using Object Versioning
-
Guided Lab: Using Cloud Storage Lifecycle Rules to Automate Object Management
-
Guided Lab: Managing Cloud Storage Buckets via SSH Commands
-
Guided Lab: Creating a Cloud SQL Instance
-
Guided Lab: Running SQL Commands in Cloud SQL Studio
-
Guided Lab: Creating and Restoring Cloud SQL Backups
-
Guided Lab: Integrating Cloud SQL Database instance with a VM instance
-
Guided Lab: Connecting Cloud SQL Database with MySQL Workbench (Local)
-
Guided Lab: Guarding Your Cloud SQL Instances with Deletion Protection
-
Guided Lab: Creating a Cloud NAT Gateway
-
Guided Lab: Creating a Google Kubernetes Engine (GKE) Cluster
-
Guided Lab: Connecting to a Kubernetes Engine Cluster
-
Guided Lab: Deploying a Simple Web Application on GKE
-
Guided Lab: Creating a Custom Virtual Private Cloud (VPC)
-
Guided Lab: Establishing VPC Peering for Secure Cross‑Network Communication
-
Guided Lab: Configuring Firewall Rules to Secure and Access a VM
-
Guided Lab: Creating an Application Load Balancer
-
Guided Lab: Creating a Network Load Balancer
Guided Lab: Managing Cloud Storage Buckets via SSH Commands
Description
Google Cloud Storage provides scalable and secure object storage for your data, such as documents, images, logs, and other application assets. While the Google Cloud Console offers a graphical interface to manage buckets and objects, using SSH (Cloud Shell) commands allows you to automate tasks, perform batch operations, and work efficiently without relying on the web interface.
In this guided lab, you will practice managing Cloud Storage entirely from the command line. You will create a private bucket, upload a .txt file, read and process its contents directly from the bucket, copy it to your Cloud Shell environment, and perform basic text operations. By the end of this lab, you will understand how to manage Cloud Storage objects using gsutil commands and apply these skills to scripting, automation, and real-world workflows.
Prerequisites
This lab assumes you are familiar with basic Cloud Storage concepts, navigating the Google Cloud Console, and using Cloud Shell.
If you find any gaps in your knowledge, consider taking the following labs:
Objectives
In this lab, you will:
- Create a Cloud Storage bucket using Cloud Shell
- Upload a file to the bucket using SSH commands
- Read the file directly from the bucket
- Copy the file to your Cloud Shell environment
Lab Steps
Creating a Cloud Storage Bucket via SSH
1. Click Activate Cloud Shell in the top-right corner of the console.

2. Authorize Cloud Shell using your account’s credentials.

3. Run the following command to create a bucket (replace <your-unique-bucket-name> with a unique name):
gsutil mb -l us-central1 gs://<your-unique-bucket-name>/

4. Verify that the bucket was created
gsutil ls

Uploading a File to the Bucket
1. If you don’t have a file locally, create a sample .txt file:
echo "Hello TDojo, this is a test file." > demo.txt
2. Upload the file to your bucket:
gsutil cp demo.txt gs://<your-unique-bucket-name>/

3. Verify the upload:
gsutil ls gs://<your-unique-bucket-name>/

Accessing and Managing the File using SSH Commands
Let’s now test viewing your file directly from the bucket, copying it to your Cloud Shell environment, and updating it if needed:
1. Display the contents of the file directly from the bucket:
gsutil cat gs://<your-unique-bucket-name>/demo.txt

2. Copy the file to your Cloud Shell home directory:
gsutil cp gs://<your-unique-bucket-name>/demo.txt ~/

3. Open the file in a text editor, then make changes if you like, then save and exit:
nano ~/demo.txt

- To save the file, press Ctrl + O, then the Enter key to save the changes. Then, to exit, just press Ctrl + X.
4. Copy the updated file back to the bucket:
gsutil cp ~/demo.txt gs://<your-unique-bucket-name>/

5. To verify if the file was copied back to the bucket, navigate to Cloud Storage in the Google Cloud Console, then check if the created bucket and file exist.


Congratulations! You’ve successfully created and managed a Cloud Storage bucket, uploaded a file, read it directly from the bucket, and copied it to your Cloud Shell environment. This guided lab helps you understand how to interact with Cloud Storage using SSH commands, manage objects, and perform basic file operations without relying on the web console. You can use these same concepts to automate storage workflows, integrate Cloud Storage with scripts or applications, and in future guided labs, you’ll explore more advanced object management and data processing techniques.