在 JupyterLab 中存取 Cloud Storage bucket 和檔案
本頁說明如何將 Cloud Storage bucket 掛接到 Vertex AI Workbench 執行個體的 JupyterLab 介面,以便瀏覽儲存在 Cloud Storage 中的檔案。您也可以開啟及編輯與 JupyterLab 相容的檔案,例如文字檔和筆記本 (IPYNB) 檔案。
總覽
Vertex AI Workbench 執行個體包含 Cloud Storage 整合功能,可讓您掛接 Cloud Storage 值區。也就是說,您可以在 JupyterLab 介面中瀏覽 bucket 內容,並使用相容的檔案。
在與 Vertex AI Workbench 執行個體相同的專案中,您可以存取執行個體有權存取的任何 Cloud Storage 值區和檔案。
事前準備
- 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.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Notebooks API.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Notebooks API.
-
Notebooks Runner (
roles/notebooks.runner
) -
Storage 物件使用者 (
roles/storage.objectUser
) - 如需建立 Cloud Storage bucket,請參閱「建立 bucket」。
- 如果尚未建立,請在與 Cloud Storage 值區相同的專案中建立 Vertex AI Workbench 執行個體。
-
前往 Google Cloud 控制台的「Instances」(執行個體) 頁面。
-
按一下 Vertex AI Workbench 執行個體名稱旁的「Open JupyterLab」(開啟 JupyterLab)。
Vertex AI Workbench 執行個體會開啟 JupyterLab。
-
在 JupyterLab 中,確認已選取「File Browser」
「檔案瀏覽器」分頁標籤。 -
按一下左側邊欄中的「掛接共用儲存空間」
按鈕。如果沒有看到這個按鈕,請拖曳側欄右側,展開側欄,直到看到這個按鈕為止。 -
在「Bucket name」(值區名稱) 欄位中,輸入要掛接的 Cloud Storage 值區名稱。
-
按一下「掛接」。
-
Cloud Storage bucket 會以資料夾的形式顯示在左側邊欄的「檔案瀏覽器」分頁中。按兩下資料夾開啟並瀏覽內容。
進一步瞭解 Cloud Storage。
必要的角色
如要取得將 Cloud Storage 值區掛接至 Vertex AI Workbench 執行個體所需的權限,請要求管理員授予您專案的下列 IAM 角色:
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和機構的存取權」。
啟用共用儲存空間掛接功能所需的權限
如要在 Vertex AI Workbench 執行個體中啟用共用儲存空間掛接功能,請要求管理員授予 Vertex AI Workbench 執行個體服務帳戶專案的 storage.buckets.list
權限。
您必須具備 storage.buckets.list
權限,Vertex AI Workbench 執行個體的 JupyterLab 介面才會顯示「掛接共用儲存空間」按鈕。
建立 bucket 和 Vertex AI Workbench 執行個體
您必須有權存取與 Vertex AI Workbench 執行個體位於同一專案中的至少一個 Cloud Storage bucket。開啟 JupyterLab
掛接 Cloud Storage bucket
如要掛接並存取 Cloud Storage bucket,請按照下列步驟操作:
疑難排解
如要瞭解如何診斷及解決將 Cloud Storage 值區掛接到執行個體的問題,請參閱「排解 Vertex AI Workbench 問題」。