Create two Cloud Storage Buckets

Check my progress

/ 20

Upload image file to your Cloud Storage Bucket

Check my progress

/ 20

Copy a file to another bucket

Check my progress

/ 20

Make your object(file) publicly accessible

Check my progress

/ 20

Delete file and Cloud Storage bucket (Bucket 1)

Check my progress

/ 20

This lab may incorporate AI tools to support your learning.

ARC125

Google Cloud 自學實驗室

總覽

在挑戰研究室中,您會在特定情境下完成一系列任務。挑戰研究室不會提供逐步說明,您將運用從課程研究室學到的技巧,自行找出方法完成任務!自動評分系統 (如本頁所示) 將根據您是否正確完成任務來提供意見回饋。

在您完成任務的期間,挑戰研究室不會介紹新的 Google Cloud 概念。您須靈活運用所學技巧,例如變更預設值或詳讀並研究錯誤訊息,解決遇到的問題。

若想滿分達標,就必須在時限內成功完成所有任務!

設定和需求

瞭解以下事項後,再點選「Start Lab」按鈕

請詳閱以下操作說明。實驗室活動會計時,且中途無法暫停。點選「Start Lab」後就會開始計時,顯示可使用 Google Cloud 資源的時間。

您將在真正的雲端環境完成實作實驗室活動,而不是模擬或示範環境。為此,我們會提供新的暫時憑證,供您在實驗室活動期間登入及存取 Google Cloud。

為了順利完成這個實驗室,請先確認:

  • 可以使用標準的網際網路瀏覽器 (Chrome 瀏覽器為佳)。
注意事項:請使用無痕模式 (建議選項) 或私密瀏覽視窗執行此實驗室,這可以防止個人帳戶和學員帳戶之間的衝突,避免個人帳戶產生額外費用。
  • 是時候完成實驗室活動了!別忘了,活動一旦開始將無法暫停。
注意事項:務必使用實驗室專用的學員帳戶。如果使用其他 Google Cloud 帳戶,可能會產生額外費用。

挑戰情境

您剛獲聘,現在是雲端工程師,到目前為止,您已協助多個團隊使用各種專案所需的 Google Cloud 服務。目前專案的一項需求是使用 Cloud Storage API,建立新 bucket、上傳檔案、在 bucket 間複製檔案、將物件設為可公開存取,以及刪除檔案和 bucket。

您應具備完成下列工作所需的技能與知識。

您的挑戰

在這項挑戰中,您的任務是使用 Cloud Storage JSON/REST API 建立 bucket、上傳檔案、將檔案複製到另一個 bucket、將物件 (檔案) 設為可公開存取,以及刪除原始檔案和 bucket。

您需要使用 Cloud Storage JSON/REST API 執行下列工作:

  • 建立 bucket。
  • 將物件檔案上傳至 Cloud Storage bucket。
  • 將檔案複製到另一個 bucket。
  • 將檔案設為可公開存取。
  • 從第一個 Cloud Storage bucket 刪除檔案。
  • 刪除第一個 Cloud Storage bucket。

過程中請遵守下列規則:

  • 請務必設定專案 ID 的環境變數,並取得 Cloud Storage API 的授權權杖,以便在 Cloud Shell 使用。 詳情請參閱「Google Cloud API 簡介」實驗室。
  • 請務必使用 Cloud Storage JSON/REST API 完成各項工作。

各項工作的詳細說明如下,祝您好運!

工作 1:建立兩個 Cloud Storage bucket

  1. 在 Cloud Shell 建立 JSON 檔案,並加入下列程式碼:
{ "name": "{{{project_0.startup_script.project_id | filled in at lab start}}}-bucket-1", "location": "us", "storageClass": "multi_regional" }
  1. 使用 curl 呼叫 JSON API,建立值區。

  2. 重複步驟一和二,建立第二個 bucket,並命名為 -bucket-2。

點選「Check my progress」,確認目標已達成。 建立兩個 Cloud Storage bucket

工作 2:將圖片檔上傳至 Cloud Storage bucket

  1. 請將下方的圖片儲存至電腦,並自行命名。

世界地圖

  1. 在 Cloud Shell 工作階段,按一下右上角的「更多」選單圖示 「更多」選單圖示。依序點選「上傳」>「選擇檔案」。選取並上傳檔案。圖片就會新增至主目錄。

  2. 使用 curl 呼叫 JSON API,將檔案上傳至 bucket -bucket-1。

點選「Check my progress」,確認目標已達成。 將圖片檔上傳至 Cloud Storage bucket

工作 3:將檔案複製到另一個 bucket

在這項工作中,請使用 curl 呼叫 JSON API,將圖片檔案從 Cloud Storage bucket -bucket-1 複製到第二個 bucket -bucket-2。

點選「Check my progress」,確認目標已達成。 將檔案複製到另一個 bucket

工作 4:將物件 (檔案) 設為可公開存取

  1. 建立包含下列程式碼的 JSON 檔案:
{ "entity": "allUsers", "role": "READER" }
  1. 使用 curl 呼叫 JSON API,將物件 (檔案) 設為可公開存取。

點選「Check my progress」,確認目標已達成。 將物件 (檔案) 設為可公開存取

工作 5:刪除物件檔案和 Cloud Storage bucket (bucket 1)

在這項工作中,您將進行清理作業。

檔案已複製到第二個 Cloud Storage bucket -bucket-2,現在要刪除第一個 bucket (bucket 1) 中的物件檔案和 bucket 1 -bucket-1。

  1. 使用 curl 呼叫 JSON API,刪除儲存在 Cloud Storage bucket -bucket-1 的檔案。

  2. 使用 curl 呼叫 JSON API,刪除 Cloud Storage bucket -bucket-1。

點選「Check my progress」,確認目標已達成。 刪除檔案和 Cloud Storage bucket (bucket 1)

恭喜!

「搭配使用 API 和 Cloud Storage」徽章

您已成功使用 JSON REST API 建立 Cloud Storage bucket、上傳檔案、在 bucket 間複製物件、將物件設為可公開存取,以及刪除檔案和 bucket。

Google Cloud 教育訓練與認證

協助您瞭解如何充分運用 Google Cloud 的技術。我們的課程會介紹專業技能和最佳做法,讓您可以快速掌握要領並持續進修。我們提供從基本到進階等級的訓練課程,並有隨選、線上和虛擬課程等選項,方便您抽空參加。認證可協助您驗證及證明自己在 Google Cloud 技術方面的技能和專業知識。

使用手冊上次更新日期:2025 年 12 月 10 日

實驗室上次測試日期:2023 年 6 月 12 日

Copyright 2026 Google LLC 保留所有權利。Google 和 Google 標誌是 Google LLC 的商標,其他公司和產品名稱則有可能是其關聯公司的商標。

Before you begin

  1. Labs create a Google Cloud project and resources for a fixed time
  2. Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
  3. On the top left of your screen, click Start lab to begin

Use private browsing

  1. Copy the provided Username and Password for the lab
  2. Click Open console in private mode

Sign in to the Console

  1. Sign in using your lab credentials. Using other credentials might cause errors or incur charges.
  2. Accept the terms, and skip the recovery resource page
  3. Don't click End lab unless you've finished the lab or want to restart it, as it will clear your work and remove the project

This content is not currently available

We will notify you via email when it becomes available

Great!

We will contact you via email if it becomes available

One lab at a time

Confirm to end all existing labs and start this one

Use private browsing to run the lab

Using an Incognito or private browser window is the best way to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.

Complete this quick step to start your lab.