hands-on lab

Working with Google Cloud Storage from the Command Line

Difficulty: Intermediate
Duration: Up to 1 hour
Students: 1,725
Rating: 4.7/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

The gsutil component of the Google Cloud Software Developer Kit (SDK) provides a command line interface (CLI) to working with Google Cloud Storage. In contrast to using the Cloud Console to work with Cloud Storage, the CLI is ideal for automating workflows. As you will see in this lab, gsutil is capable of doing everything that you can do in the Console and much more. 

In this lab, you will use an instance that comes with gsutil pre-installed and ready to use. You will first learn how to create buckets and different methods for transferring files to Google Cloud Storage using gsutil. Lastly, you will explore Cloud Storage object versioning and see how to configure Object Lifecycle Management to control costs when versioning is enabled on a bucket.

Lab Objectives

Upon completion of this lab you will be able to:

  • Use and explain what Google Cloud Shell is
  • Use gsutil to perform a variety of Cloud Storage operations including creating buckets, transferring files, and performing diagnostic tests
  • Change the storage class of individual objects in a Cloud Storage bucket with gsutil
  • Enable object versioning on buckets with gsutil
  • Configure Object Lifecycle Management to control additional costs associated with object versioning

Lab Prerequisites

You should be familiar with:

  • Working at the command line in Linux
  • Basic Google Cloud Storage Concepts

The following labs are recommended for satisfying the prerequisites:

Updates

Dec. 21st, 2020 - Updated lab to use a GCE instance rather than Cloud Shell to avoid availability issues

Sept. 9th, 2019 - Lab content updated to reflect the latest Google Cloud Storage and gsutil experience

July 3rd, 2019 - Added a custom validation lab step

Environment before

Environment after

Covered topics

Lab steps

Signing In to the Google Cloud Console
Creating a Cloud Storage Bucket with gsutil
Uploading Files to Cloud Storage with gsutil
Understanding Object Versioning with gsutil