Checkpoint
Create a Cloud Storage Bucket
/ 25
Make a second Cloud Storage bucket
/ 25
Upload Files to Your Cloud Storage Bucket (demo-image1.png and demo-image2.png)
/ 25
Copy files between Cloud Storage buckets (demo-image1-copy.png)
/ 25
APIs Explorer: Cloud Storage
- GSP421
- Overview
- Setup and requirements
- Task 1. Create Cloud Storage Buckets
- Task 2. Make a second Cloud Storage bucket
- Task 3. Upload files to your Cloud Storage bucket
- Task 4. Copy files between Cloud Storage buckets
- Task 5. Delete files from a Cloud Storage bucket
- Task 6. Delete your Cloud Storage bucket
- Task 7. Test your understanding
- Congratulations!
GSP421
Overview
The Google APIs Explorer is a tool that helps you explore various Google APIs interactively. With the APIs Explorer, you can:
- Browse quickly through available APIs and versions.
- See methods available for each API and what parameters they support along with inline documentation.
- Execute requests for any method and see responses in real-time.
- Make authenticated and authorized API calls.
- Search across all services, methods, and your recent requests to quickly find what you are looking for.
Cloud Storage allows world-wide storage and retrieval of any amount of data at any time. You can use Cloud Storage for a range of scenarios including serving website content, storing data for archival and disaster recovery, or distributing large data objects to users via direct download.
In this lab, you will use the APIs Explorer to make Cloud Storage API requests that create and delete Cloud Storage buckets. You will also learn how to copy and delete files in Cloud Storage.
Objectives
In this lab, you will:
- Create Cloud Storage buckets using the APIs Explorer.
- Upload image files to your Cloud Storage bucket.
- Copy an image file and add it to a Cloud Storage bucket using the APIs Explorer.
- Delete image files from your Cloud Storage bucket using the APIs Explorer.
- Delete a Cloud Storage bucket using the APIs Explorer.
Setup and requirements
Before you click the Start Lab button
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.
This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
- Access to a standard internet browser (Chrome browser recommended).
- Time to complete the lab---remember, once you start, you cannot pause a lab.
How to start your lab and sign in to the Google Cloud console
-
Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:
- The Open Google Cloud console button
- Time remaining
- The temporary credentials that you must use for this lab
- Other information, if needed, to step through this lab
-
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
Note: If you see the Choose an account dialog, click Use Another Account. -
If necessary, copy the Username below and paste it into the Sign in dialog.
{{{user_0.username | "Username"}}} You can also find the Username in the Lab Details panel.
-
Click Next.
-
Copy the Password below and paste it into the Welcome dialog.
{{{user_0.password | "Password"}}} You can also find the Password in the Lab Details panel.
-
Click Next.
Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges. -
Click through the subsequent pages:
- Accept the terms and conditions.
- Do not add recovery options or two-factor authentication (because this is a temporary account).
- Do not sign up for free trials.
After a few moments, the Google Cloud console opens in this tab.
Task 1. Create Cloud Storage Buckets
-
To access the Cloud Storage APIs Explorer tool, from the Navigation menu select APIs & Services > Library.
-
In the search bar, type Cloud Storage.
-
Click on the Google Cloud Storage JSON API from the results list.
-
Make sure that API is enabled, if not click Enable.
-
Open the Buckets: insert reference. This will open a new tab with the APIs Explorer page loaded.
You will now be on the APIs Explorer page.
insert
method from Cloud Storage JSON API. You can view all API versions and its method in the API reference.
- Now click on the request body from the right panel under Try this API and fill in the details for your storage bucket:
-
project: add your Project ID -
. - Request body: click inside the quotes next to the name key-value pair and give your Cloud Storage bucket a unique name that follows the Cloud Storage bucket naming guidelines.
Your method should now resemble the following:
-
Click the Execute button.
-
Select the student account you started the lab with.
-
On the next screen, click Allow to give APIs Explorer access.
Your response should resemble the following:
Click Check my progress to verify the objective.
Task 2. Make a second Cloud Storage bucket
Now make another Cloud Storage bucket so you can get hands-on practice copying files between the two.
-
Still, in the
insert
method, ensure that your Project ID is still in the project field. -
In the request body, for the name key-value pair, give your second bucket a unique name.
-
Make sure that there are no trailing spaces in any of the fields.
-
Click the Execute button. Your response should resemble the following:
You have successfully created two buckets with the insert
method. Next you'll find them in the Cloud console.
Click Check my progress to verify the objective.
View your Cloud Storage buckets in the Cloud console
-
Return to the Cloud console and from the Navigation menu go to Cloud Storage to ensure that your Cloud Storage buckets were created.
-
From the Navigation menu select Cloud Storage > Buckets. You should see your newly created buckets added.
Remain in the Cloud console for the following step. Keep the APIs Explorer tab open.
Task 3. Upload files to your Cloud Storage bucket
Upload some files to your Cloud Storage bucket so you can get hands-on practice with methods housed in the APIs explorer.
- Save the following image to your computer and name it demo-image1.png:
- Now save this public domain image of Ada Lovelace to your computer and name it demo-image2.png:
-
In the Cloud Storage browser select the first bucket from the list.
-
Click Upload files and select demo-image1.png and demo-image2.png from your computer.
Your bucket should now have both image files added to it and should resemble the following:
Click Check my progress to verify the objective.
Next, you will copy one of the image files to your second Cloud Storage bucket.
Task 4. Copy files between Cloud Storage buckets
-
From the left APIs & Reference section, navigate to JSON API > API reference > Objects > copy to
copy
method or, to copy files between storage buckets using API Explorer, use the Objects: copy reference. -
Update as follows:
- sourceBucket: type in the name of the bucket that contains the demo image files.
- sourceObject: enter in demo-image1.png.
- destinationBucket: enter intype the name of your second (empty) bucket.
- destinationObject: type in demo-image1-copy.png.
Your method should resemble the following:
- Make sure that Google OAuth 2.0 and API key checkboxes are selected under Credentials section.
-
Make sure that there are no trailing spaces in any of the fields.
-
Now scroll down and click Execute.
You should receive a similar output:
You have successfully copied a file from one bucket to another using the objects.copy
method.
Click Check my progress to verify the objective.
View your updated bucket in the Cloud console
-
Return to the Cloud console for this step. You should have left off on your Cloud Storage bucket details page.
-
From the left-hand menu, click Buckets and select your second bucket. You should see the copy of demo-image1.png added.
Task 5. Delete files from a Cloud Storage bucket
-
From the left APIs & Reference section navigate to JSON API > API reference > Objects > delete or, to delete files from a Cloud Storage bucket using API Explorer, use the Objects: delete reference.
-
Now you'll delete an image file from a Cloud Storage bucket.
- bucket: enter in the name of your bucket that contains both demo image files.
- object: enter in demo-image1.png. Your method should resemble the following:
- Make sure that Google OAuth 2.0 and API key checkboxes are selected under Credentials section.
-
Make sure that there are no trailing spaces in any of the fields.
-
Now scroll down and click Execute.
You should receive a similar output as below:
- Now remove the second image from the Cloud Storage bucket. Still in the same method, for the object field, enter in demo-image2.png. Your bucket name will remain the same. Your method should resemble the following:
- Now scroll down and click Execute. You should receive a similar output:
You have successfully deleted files from a bucket using the objects.delete
method. You will now view your removed file in the Cloud console.
View your updated bucket in the Cloud console
-
Return to the Cloud console for this step. You should have left off on your Cloud Storage bucket details page.
-
From the left-hand menu, click Buckets and select your first bucket. You should see that both images have been removed.
Task 6. Delete your Cloud Storage bucket
- From the left APIs & Reference section navigate to JSON API > API reference > Buckets > delete to
buckets.delete
method or, to delete a Cloud Storage bucket using API Explorer, use the Buckets: delete reference.
You will now delete your first (empty) Cloud Storage bucket.
- For the bucket field, enter in the name of your first bucket. Your method should resemble the following:
- Make sure that Google OAuth 2.0 and API key checkboxes are selected under Credentials section.
-
Make sure that there are no trailing spaces in any of the fields.
-
Now scroll down and click Execute. You should receive a similar output:
You have successfully deleted a bucket using the buckets.delete
method.
View your updated bucket in the Cloud console
-
Return to the Cloud console for this step. You should have left off on the Details page.
-
From the left-hand menu, click Buckets. You should see that your first bucket has been removed.
You have successfully completed all steps of the lab. You can end your lab here, or experiment with some new methods in the remaining time.
Task 7. Test your understanding
Below are multiple-choice questions to reinforce your understanding of this lab's concepts. Answer them to the best of your abilities.
Congratulations!
In this lab you created Cloud Storage buckets with the APIs Explorer. You also copied and deleted image files with specific APIs Explorer methods. After deleting image files, you learned how to delete an entire bucket with the delete
method. At this point, you have a solid understanding of Cloud Storage and how you can provision this service's methods through the APIs Explorer.
Next steps / Learn more
For more practice with the APIs Explorer, try this lab:
APIs Explorer: Create and Update a Cluster
Google Cloud training and certification
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated November 04, 2024
Lab Last Tested November 04, 2024
Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.