
准备工作
- 实验会创建一个 Google Cloud 项目和一些资源,供您使用限定的一段时间
- 实验有时间限制,并且没有暂停功能。如果您中途结束实验,则必须重新开始。
- 在屏幕左上角,点击开始实验即可开始
Create a bucket
/ 25
Upload objects to your bucket
/ 25
Sync changes with bucket
/ 25
Copy with different storage class
/ 25
In this lab, you will use gsutil
to create a bucket and perform operations on objects. gsutil
is a Python application that lets you access Cloud Storage from the command line. The gsutil
tool has commands such as mb
and cp
to perform operations. Each command has a set of options that are used to customize settings further.
The gsutil mb
command is used to create a new Google Cloud Storage bucket. The -c
flag allows you to specify the storage class for the bucket, and the multi_regional
storage class is designed for data that needs to be available in multiple regions (ideal for high availability and low-latency access).
Click Check my progress to verify the objective.
endpointslambda
object to your bucket:The gsutil -m cp -r
command is used to copy files or directories to a Google Cloud Storage bucket
If you have a large number of files to transfer, you might want to use the -m
option, to perform a parallel (multi-threaded/multi-processing) copy for faster performance. The -r
option allows gsutil to recurse through directories.
Click Check my progress to verify the objective.
This command lists all objects (files and directories) inside a specific bucket in Google Cloud Storage, including any nested objects.
In this command, the -d
option deletes files from the target if they're missing in the source (in this case, it deletes app.yaml from the bucket). The -r
option runs the command recursively on directories.
Click Check my progress to verify the objective.
endpointslambda
folder in your bucket, execute the following command:The above command is used to set access control lists (ACLs) on Cloud Storage buckets or objects. This makes all the objects in a bucket publicly readable.
The -m
flag enables parallel processing, which means multiple operations (like setting ACLs on many files) will be executed simultaneously, speeding up the process. The -R
flag applies the ACL recursively to all objects inside the bucket. Without this, it would only apply to the bucket itself, not its contents.
<your-bucket-name>
with the full name of your bucket, not the environment variable:This URL uses the Cloud Storage API link to view the object without authentication. Learn more about accessing public data from the Accessing public data documentation.
The gsutil cp
command is used to copy files from one location to another, either within Cloud Storage or from a local file system to Cloud Storage and -s
flag specifies the storage class for the file being uploaded.
Click Check my progress to verify the objective.
space
key to continue viewing the rest of the command's output.The output shows that the ghcn_on_bq.ipynb object has NEARLINE
storage class while the other objects have MULTI_REGIONAL
storage class.
Output:
You have now learned how to perform operations on Cloud Storage buckets and objects!
For complete information about the gsutil command-line options, see:
...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 May 21, 2025
Lab Last Tested May 21, 2024
Copyright 2025 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.
此内容目前不可用
一旦可用,我们会通过电子邮件告知您
太好了!
一旦可用,我们会通过电子邮件告知您
一次一个实验
确认结束所有现有实验并开始此实验