本頁面將逐步介紹使用 Cloud Life Sciences API 所需的設定步驟。
如果您完成這門快速入門導覽課程,則您已完成其中某些步驟。請參閱本說明頁面,確保為使用 Cloud Life Sciences API 做好準備。
事前準備
- 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 Cloud Life Sciences 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 Cloud Life Sciences API.
- 系統會建立名為「Cloud Life Sciences 服務代理人」的服務帳戶。
- 系統會自動為服務帳戶指派預設角色
lifesciences.workflowsRunner
。這個角色可啟動及停止專案內的 Compute Engine 執行個體。 - 嘗試使用 API 執行管道時,會導致權限錯誤。如要修正這個問題,請參閱「疑難排解」一文。
- 管道完成時,API 無法關閉執行中的執行個體,且您將繼續為這些資源付費。如要修正這個問題,請參閱「疑難排解」一文。
初始化 SDK 後,安裝 Cloud Life Sciences 元件:
gcloud components update beta
如果您將 Compute Engine VM 與 gcloud CLI 的預設安裝搭配使用,則無法使用先前的指令安裝元件。如要在 Compute Engine VM 上啟用 Cloud Life Sciences API,請執行下列指令來重新安裝 gcloud CLI:
sudo apt-get remove google-cloud-sdk curl https://sdk.cloud.google.com | bash exec -l $SHELL gcloud init
- Cloud Life Sciences GitHub 存放區中的程式碼範例
- 使用非 Google Cloud CLI 的工具,直接存取 Cloud Life Sciences API
前往 Google Cloud 控制台的「憑證」頁面。
依序按一下「建立憑證」>「服務帳戶」。
在「服務帳戶詳細資料」頁面上,輸入服務帳戶名稱,然後按一下「建立」。
在「將專案存取權授予這個服務帳戶」分頁中,選取服務帳戶的角色。如要取得 Cloud Life Sciences 的最廣泛存取權,請依序選取「Cloud Life Sciences」>「Cloud Life Sciences Workflows Runner」,然後按一下「繼續」。
(選用) 填寫「將這個服務帳戶的存取權授予使用者」分頁。
按一下 [完成]。
前往 Google Cloud 控制台的「Service Accounts」(服務帳戶) 頁面。
找出要建立金鑰的服務帳戶所在列。 在該列中,依序按一下「更多」
和「管理金鑰」。在「金鑰」頁面中,依序點選「新增金鑰」和「建立新的金鑰」。
在「Key type」(金鑰類型) 下選取「JSON」,然後按一下「Create」(建立)。
- 使用 BigQuery 分析變異基因段。
- 在 Cloud Storage 與 BigQuery 中儲存及載入變異基因段。
- 查看使用 Cloud Life Sciences API 執行管道的教學課程。
瞭解服務帳戶和預設角色
首次執行管道時 (使用 gcloud CLI 或 RPC 和 REST API),會發生下列驗證步驟:
如果您稍後從相關專案服務帳戶中移除預設角色,可能會遇到下列錯誤:
設定 Google Cloud CLI 和 Google Cloud CLI
安裝 Google Cloud CLI 即可使用 Cloud Life Sciences、Compute Engine、Cloud Storage 和 BigQuery 中的工具和程式庫。SDK 包含 gcloud
、gsutil
和 bq
指令列工具。
下載憑證以存取 API
如果您使用下列任一方法存取 Cloud Life Sciences API,就必須下載專案的服務帳戶金鑰檔案:
請完成下列步驟,建立服務帳戶金鑰檔案:
如要下載服務帳戶金鑰,請完成下列步驟:
按一下「Create」(建立),即可下載服務帳戶金鑰檔案。請務必妥善保存這個檔案,因為此檔案可當做服務帳戶進行驗證。您可以移動及重新命名這個檔案。