Skip to main content

Working with Google Cloud Storage

Hands-On Lab


Photo of Joseph Lowery

Joseph Lowery

Google Cloud Training Architect II in Content





Digital objects — images, videos, documents, etc. — are a key aspect of any type of computing, whether local or cloud-based. Cloud Storage is Google Cloud's central facility for storing and retrieving your binary objects and is therefore utilized by the vast majority of applications on the platform. In this hands-on lab, you’ll gain practical experience in creating and managing the primary component of Cloud Storage, the bucket, as well as manipulating the objects it holds, through both the Google Cloud console and the command line. Note: The export bucket mentioned by the instructor is no longer created and not needed for the lab.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Working with Google Cloud Storage

In this hands-on lab, we’ll create and manage the primary component of Cloud Storage — the bucket — as well as manipulate the objects it holds through both the Google Cloud console and the command line.

Before starting, download the diagram from the course downloads page, and store it in an easily accessible location.

How to Log in to Google Lab Accounts

On the lab page, right-click Open GCP Console and select the option to open it in a new private browser window (this option will read differently depending on your browser — e.g., in Chrome, it says "Open Link in Incognito Window"). Then, sign in to Google Cloud Platform using the credentials provided on the lab page.

On the Welcome to your new account screen, review the text, and click Accept. In the "Welcome L.A.!" pop-up once you're signed in, check to agree to the terms of service, choose your country of residence, and click Agree and Continue.

Working with Cloud Storage

Now, on to the lab!

Enable APIs.

  1. Navigate to APIs & Services > Library.
  2. Search for "cloud storage", select Google Cloud Storage, and make sure it's enabled.

Create a bucket.

  1. Navigate to Storage > Browser.
  2. Click Create Bucket.
  3. Name the bucket uniquely (e.g., "la-cs-001" with extra numbers or initials).
  4. Select an appropriate storage class (e.g., Regional).
  5. Click Create.

Add file to bucket.

  1. Click the bucket name to get into it.
  2. Drag and drop an image onto the interface.
  3. Click the name of the object in the bucket to verify.

Rename the object.

  1. From the object context menu (the three vertical dots on the right), choose Rename.
  2. Give the object a new name.

Share the object publicly.

  1. From the selected object's context menu, choose Edit permissions.
  2. Click + Add item, and set the following values:
    • Entity: User
    • Name: allUsers
    • Access: Reader
  3. Click Save.
  4. Choose the Objects tab.
  5. Confirm the operation by clicking the new link under Public access.

Create a folder.

  1. On the bucket page, click Create folder.
  2. Name the folder (e.g., "artwork") and click Create.
  3. Click the folder name to get into it, and then click the Permissions tab.
  4. Click Add members, and set the following values:
    • Members: allUsers
    • Roles: Storage Object Viewer
  5. Click Add.

Upload folder of files.

  1. Click the Activate Cloud Shell icon in the upper right navigation bar.

  2. Clone a repo:

    git clone
  3. Change directory to the repo:

    cd content-gcpro-developer
  4. Download all files in folder from repo:

    cloudshell dl cloud-functions-lab/*
  5. Create a new folder on your desktop, and place all files within it.

  6. In the console, choose Upload folder, and select the new folder on your desktop. Click Upload.

Perform Cloud Storage operations via command line.

  1. In the Cloud Shell, cd to the cloud-functions-lab folder:

    cd content-gcpro-developer/cloud-functions-lab
  2. Copy file to bucket:

    gsutil cp gs://<BUCKET_NAME>
  3. List contents of bucket:

    gsutil ls gs://<BUCKET_NAME>
  4. Create a new bucket:

    gsutil mb -c regional -l us-central1 gs://<NEW_BUCKET_NAME>
  5. Verify bucket was created:

    gsutil ls
  6. Move a file into the new bucket:

    gsutil cp gs://<NEW_BUCKET_NAME>
  7. Make object publicly accessible:

    gsutil acl ch -u AllUsers:R gs://<NEW_BUCKET_NAME>/
  8. Copy a file from another project's bucket:

    gsutil cp gs://la-gcloud-course-resources/pro-developer/pinehead-meme.jpg gs://<NEW_BUCKET_NAME>


Congratulations on completing this lab!