Google Cloud Storage provides simple, scalable, unstructured storage. In this context, "unstructured" means that the Cloud Storage service treats your data as an ordered sequence of bytes, and does not pay any attention to any internal structure that your data may have. This stands in contrast to structured storage options, where the data is treated more like a table with rows and columns.

In Cloud Storage, "objects" are stored in "buckets". This is similar to how "files" are stored in "folders" or "directories", but unlike directories, buckets cannot be nested inside of other buckets to form hierarchies.

In this lab, we will create a new, empty Cloud Storage bucket and upload an object from local storage to the new bucket.

What you'll learn

What you'll need

How will you use use this tutorial?

Read it through only Read it and complete the exercises

How would you rate your experience with using Google Cloud Platform services and Firebase?

Novice Intermediate Proficient

Codelab-at-a-conference setup

The instructor will be sharing with you temporary accounts with existing projects that are already setup so you do not need to worry about enabling billing or any cost associated with running this codelab. Note that all these accounts will be disabled soon after the codelab is over.

Once you have received a temporary username / password to login from the instructor, log into the Google Cloud Console:

Here's what you should see once logged in :

In the Google Cloud Console, click the Menu icon on the top left of the screen:

Scroll down and select Cloud Storage in the Storage subsection:

You should now see the Cloud Storage Browser, and assuming you are using a project that does not currently have any Cloud Storage buckets, you will see a dialog box inviting you to create a new bucket:

If you happen to be using a project that already has one or more buckets, you will instead see a list of those buckets:

Assuming your project has no buckets, press the Create bucket button to create one:

If you are using a project that already has one or more buckets, press the Create Bucket button on the Buckets screen as shown here:

In either case, you should now see the Create a bucket dialog:

Enter a name for your bucket. As the dialog box notes, bucket names must be unique across all of Cloud Storage. So if you choose an obvious name, such as "test", you will probably find that someone else has already created a bucket with that name, and will receive an error like this one:

There are also some rules regarding what characters are allowed in bucket names. If you start and end your bucket name with a letter or number, and only use dashes in the middle, then you'll be fine. If you try to use special characters, or try to start or end your bucket name with something other than a letter or number, the dialog box will remind you of the rules.

Enter a unique name for your bucket and press Create. If you choose something that's already in use, you will see the error message shown above. When you have successfully created a bucket, you will be taken to your new, empty, bucket in the browser:

The bucket name you see will, of course, be different, since they must be unique across all projects.

Note: If you're having trouble thinking up a unique name, you can be sure that your project ID is unique, and thus using it as a prefix for your bucket name will usually work, as shown in this example. You can find your project ID by returning to the home screen in the Cloud Console:

In this example we accepted the default Bucket Location and Storage Class, which will be fine for many scenarios. At the end of this codelab, you will find links to learn more about Bucket Locations and Storage Classes.

Now that you have a Cloud Storage bucket, we are going to see how to upload an object to it from your local machine. If you aren't in the storage view, return to it by navigating the left menu, or hitting "/" and type "storage, or use the magnifier glass on the top bar and search for storage. First we need something to upload. Download this object to the local storage of the machine you are using.

To upload an object, press Upload Files:

What happens next will depend on the type of computer you are using. A system dependant dialog will be displayed that will let you select a file from local storage to upload. Find the file you downloaded earlier, and select it.

When the upload is complete, you will see the object listed in the bucket:

You can close the upload status window by pressing the X in the upper right corner.

You have now uploaded an object to Cloud Storage. Assuming you do not want to keep this example bucket and object, you should now delete them to avoid being charged for storing data you do not want.

Return to the bucket list by clicking Buckets:

In the buckets page select the checkbox next to the bucket you want to delete, then press Delete:

You will be warned that deleting the bucket will also delete all the contents of the bucket. Confirm the deletion by pressing the Delete button:

You have now created and deleted buckets and objects using the Cloud Storage browser in the Google Cloud Console.

What we've covered

Learn More