Ends in
00
hrs
00
mins
00
secs
SHOP NOW

💝 48-Hour Valentine's Sale Extension! Get 30% OFF Any Reviewer. Use coupon code: VDAYSALE2026 & 5% OFF Store Credits/Gift Cards

Back to Course

GCP PlayCloud Labs

0% Complete
0/0 Steps
  1. GCP PlayCloud Labs
  2. Guided Lab: How to Launch a GCP Compute Engine Linux Instance
  3. Guided Lab: Creating a VM Using Instance Templates
  4. Guided Lab: Creating and Managing Instance Groups in Compute Engine
  5. Guided Lab: Creating a Spot VM Instance
  6. Guided Lab: Configuring Shielded VM Options
  7. Guided Lab: Exploring Instance Metadata in Google Cloud
  8. Guided Lab: Vertically Scaling a VM Instance
  9. Guided Lab: Setting up a Web Server on a VM Instance
  10. Guided Lab: Using Startup Scripts in GCP VM Instances
  11. Guided Lab: Creating a Custom Image from a VM Instance with Web Server in Google Cloud
  12. Guided Lab: Creating VM Snapshots and Restoring a VM from a Snapshot
  13. Guided Lab: Setting Up and Managing a Database on a VM Instance
  14. Guided Lab: Installing WordPress on an Ubuntu VM Instance with LEMP Stack
  15. Guided Lab: Deploying a LAMP Stack on a Compute Engine VM
  16. Guided Lab: Reserving or Promoting a Static IP Address for a VM Instance
  17. Guided Lab: SSH Access to GCP VM Instance from Local Machine using SSH Key Pair
  18. Guided Lab: Guarding Your VM with Deletion Protection
  19. Guided Lab: Setting Up a Linux Bastion Host on GCP
  20. Guided Lab: Creating a Cloud Storage Bucket
  21. Guided Lab: Uploading, Organizing, and Managing Objects in Cloud Storage
  22. Guided Lab: Exploring Google Cloud Storage Classes
  23. Guided Lab: Hosting a Static Website in Google Cloud Storage Bucket
  24. Guided Lab: Protecting Data on Cloud Storage Bucket Against Accidental Delete and Overwrite Using Object Versioning
  25. Guided Lab: Using Cloud Storage Lifecycle Rules to Automate Object Management
  26. Guided Lab: Managing Cloud Storage Buckets via SSH Commands
  27. Guided Lab: Creating a Cloud SQL Instance
  28. Guided Lab: Running SQL Commands in Cloud SQL Studio
  29. Guided Lab: Creating and Restoring Cloud SQL Backups
  30. Guided Lab: Integrating Cloud SQL Database instance with a VM instance
  31. Guided Lab: Connecting Cloud SQL Database with MySQL Workbench (Local)
  32. Guided Lab: Guarding Your Cloud SQL Instances with Deletion Protection
  33. Guided Lab: Creating a Cloud NAT Gateway
  34. Guided Lab: Creating a Google Kubernetes Engine (GKE) Cluster
  35. Guided Lab: Connecting to a Kubernetes Engine Cluster
  36. Guided Lab: Deploying a Simple Web Application on GKE
  37. Guided Lab: Creating a Custom Virtual Private Cloud (VPC)
  38. Guided Lab: Establishing VPC Peering for Secure Cross‑Network Communication
  39. Guided Lab: Configuring Firewall Rules to Secure and Access a VM
  40. Guided Lab: Creating an Application Load Balancer
  41. Guided Lab: Creating a Network Load Balancer
Lesson 26 of 41
In Progress

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.

Skip to content