使用 Google Cloud 控制台探索物件儲存空間
瞭解如何透過 Google Cloud 控制台開始使用 Cloud Storage。
Cloud Storage 產生的費用取決於您耗用的資源。這項快速入門導覽課程使用的 Cloud Storage 資源通常不到 $0.01 美元。
如要透過互動式逐步操作,在Google Cloud 控制台中執行類似工作,請按一下「Guide me」(逐步引導):
事前準備
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
- 
    
    
      In the Google Cloud console, on the project selector page, select or create a Google Cloud project. Roles required to select or create a project - Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- 
      Create a project: To create a project, you need the Project Creator
      (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
 
- 
  
    Verify that billing is enabled for your Google Cloud project. 
- 
    
        Make sure that you have the following role or roles on the project: Storage Admin Check for the roles- 
              In the Google Cloud console, go to the IAM page. Go to IAM
- Select the project.
- 
              In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator. 
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
 Grant the roles- 
              In the Google Cloud console, go to the IAM page. 前往 IAM
- 選取專案。
- 按一下 「授予存取權」。
- 
              在「New principals」(新增主體) 欄位中,輸入您的使用者 ID。 這通常是 Google 帳戶的電子郵件地址。 
- 在「Select a role」(選取角色) 清單中,選取角色。
- 如要授予其他角色,請按一下 「新增其他角色」,然後新增每個其他角色。
- 按一下 [Save]。
 
- 
              
- 
    
    
      In the Google Cloud console, on the project selector page, select or create a Google Cloud project. Roles required to select or create a project - Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- 
      Create a project: To create a project, you need the Project Creator
      (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
 
- 
  
    Verify that billing is enabled for your Google Cloud project. 
- 
    
        Make sure that you have the following role or roles on the project: Storage Admin Check for the roles- 
              In the Google Cloud console, go to the IAM page. Go to IAM
- Select the project.
- 
              In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator. 
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
 Grant the roles- 
              In the Google Cloud console, go to the IAM page. 前往 IAM
- 選取專案。
- 按一下 「授予存取權」。
- 
              在「New principals」(新增主體) 欄位中,輸入您的使用者 ID。 這通常是 Google 帳戶的電子郵件地址。 
- 在「Select a role」(選取角色) 清單中,選取角色。
- 如要授予其他角色,請按一下 「新增其他角色」,然後新增每個其他角色。
- 按一下 [Save]。
 
- 
              
- 在 Google Cloud 控制台,前往「Cloud Storage bucket」頁面。
 
- 按一下「建立」add_box,開啟值區建立表單。 
- 展開各個部分,輸入 bucket 資訊,然後點選「繼續」來完成各個步驟: - 在「開始使用」專區中,輸入 bucket 的全域不重複名稱。 - 請勿在 bucket 名稱中加入機密資訊,因為 bucket 命名空間為全域通用並會公開顯示。 
 
- 在「Choose where to store your data」(選擇資料的儲存位置) 專區中,選取「Region」(區域) 單選按鈕做為「Location type」(位置類型)。選取區域選項後,會顯示下拉式欄位。這個欄位請使用預設值。 
- 在「選擇資料儲存方式」部分,使用預設值。 
- 在「Choose how to control access to objects」(選取如何控制物件的存取權) 專區中,執行下列操作: - 取消勾選「強制禁止公開存取這個 bucket」旁的核取方塊,這樣您之後就能共用物件。 
- 「存取控管」請使用預設值。 
 
- 在「選擇保護物件資料的方式」部分,使用預設值。 
 
- 點選「建立」。 
- 在下圖上按一下滑鼠右鍵,然後下載到電腦。  
- 在 Cloud Storage 值區頁面中,按一下您建立的值區名稱。 
- 按一下「物件」分頁中的「上傳檔案」。 
- 在檔案對話方塊,找到並選取剛才下載的檔案。 
- 按一下檔案清單上方的「權限」分頁標籤。 
- 按一下「授予存取權」按鈕來新增「主體」。 - 「新增主體」窗格隨即顯示。 
- 在「New principals」(新增主體) 方塊中輸入 - allUsers。
- 在「請選擇角色」下拉式選單中,依序選取「Cloud Storage」>「Storage 物件檢視者」。 
- 按一下 [儲存]。 
- 在「確定要將這項資源設為公開嗎?」視窗中,點選「允許公開存取」。 
- 按一下物件清單上方的「權限」分頁標籤。 
- 按一下與項目相關聯的核取方塊,該項目在「主體」欄中列出「allUsers」。 
- 按一下「移除存取權」按鈕。 
- 在隨即顯示的對話方塊中,按一下「Confirm」(確認)。 
- 按一下「物件」分頁中的「建立資料夾」。 
- 在「名稱」部分輸入 folder1,然後按一下「建立」。 
- 按一下「folder1」。 
- 按一下「建立資料夾」。 
- 輸入 folder2 做為名稱,然後按一下「建立」。 
- 按一下「folder2」。 
- 按一下「上傳檔案」。 
- 在檔案對話方塊,找到並選取剛才下載的螢幕截圖。 
- 點選「bucket 詳細資料」旁的箭頭,返回 bucket 層級。 
- 選取 bucket。 
- 勾選「folder1」旁的核取方塊。 
- 按一下 [Delete] (刪除) 按鈕。 
- 在開啟的視窗中,確認要繼續刪除。 
- 按一下「刪除」,即可刪除資料夾和當中的所有物件與子資料夾。 
- 在 Google Cloud 控制台中開啟 Cloud Storage 儲存空間頁面。
 開啟「Buckets」(儲存桶) 頁面
- 找出您建立的值區,並選取旁邊的核取方塊。
- 點選「刪除」。
- 在開啟的視窗中,確認要刪除值區。
- 點選「刪除」。
- 瞭解 Cloud Storage 定價。
- 開始使用 Cloud Storage 用戶端程式庫。
建立值區
「bucket」是 Cloud Storage 中存放資料的基本容器。
如要建立值區,請按照下列指示操作:
大功告成,您剛剛建立了一個 Cloud Storage 值區!
將物件上傳至 bucket
如要將範例物件上傳至新值區,請按照下列步驟操作:
上傳完成後,您應該會看見檔案名稱與相關資訊,例如檔案大小和類型等。
下載物件
如要從儲存空間下載圖片,請按一下「下載」圖示 file_download。
分享物件
如要將 bucket 開放公開存取,並為圖片建立公開存取網址,請按照下列指示操作:
如要確認是否已公開共用物件,請點選「物件」分頁標籤來返回物件清單。物件的「公開存取權」欄應會顯示「在網際網路上公開」。「複製網址」按鈕會提供可以分享的網址,類似下列內容:
https://storage.googleapis.com/YOUR_BUCKET_NAME/kitten.png
如要從 bucket 移除公開存取權,並停止公開共用圖片,請按照下列指示操作:
在「物件」分頁中,您應該會看到圖片已沒有相關聯的「複製網址」按鈕。
建立資料夾
資料夾應會出現在 bucket 中,並顯示資料夾圖示,以便與物件區分。
建立一個子資料夾並將檔案上傳到此處:
上傳完成後,您應該會看見檔案名稱與相關資訊,例如檔案大小和類型等。
刪除物件
清除所用資源
如要避免系統向您的 Google Cloud 帳戶收取本頁所用資源的費用,請按照下列步驟操作。