0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[GCP]Cloud ShellからDatalabを利用する方法

Last updated at Posted at 2019-12-03

はじめに

Cloud Datalabの「クイックスタート」にはCloud ShellからDatalabを利用する方法が記載されていませんでしたので、「Chromebook での Cloud Datalab の起動」を参考に、Cloud ShellからDatalabを利用する方法をまとめました。

クイックスタート
https://cloud.google.com/datalab/docs/quickstart?hl=ja

Chromebook での Cloud Datalab の起動
https://cloud.google.com/datalab/docs/how-to/datalab-using-shell?hl=ja

手順

1. GCP プロジェクトを選択または作成

https://cloud.google.com/datalab/docs/how-to/datalab-using-shell?hl=ja
に記載の内容と同じです。

2. Google Cloud Platform プロジェクトに対して課金が有効になっていることを確認

https://cloud.google.com/datalab/docs/how-to/datalab-using-shell?hl=ja
に記載の内容と同じです。

3. Google Compute Engine と Cloud Source Repositories API を有効にする

https://cloud.google.com/datalab/docs/how-to/datalab-using-shell?hl=ja
に記載の内容と同じです。

4. Cloud Shell から Cloud Datalab を起動する

Cloud Shellを起動した後、以下のコマンドを実行し、Cloud Datalab VM インスタンスを作成します。

datalab create <instance-name>

以下が表示されたらパスフレーズを入力します。

Enter passphrase for key '/home/user/.ssh/google_compute_engine':

しばらくすると以下のメッセージが表示されます。
表示されたら次の手順に進んでください。

The connection to Datalab is now open and will remain until this command is killed.
Click on the *Web Preview* (square button at top-right), select *Change port > Port 8081*, and start using Datalab.

5. Cloud Datalab ホームページを開く

[ウェブでプレビュー] ボタンを選択したのち、[ポートを変更]を選択します。

image.png

ポート番号に8081と入力して、[変更してプレビュー] を選択します。

image.png

6. Datalabの画面が開く

Datalabの画面が開きます。
docsの中にサンプルやチュートリアルが入っていました。

image.png

切断するにはCloud Shell側で Ctrl + c を押します。

7. 再接続方法

以下のコマンドで再接続が可能です。

datalab connect --zone <zone> --port 8081 <instance-name>

エラー対応

Quota 'NETWORKS' exceeded

Cloud Datalab VM インスタンスを作成時に以下のエラーが発生した場合は、VPCネットワークの作成可能上限数に達しているものと思われます。
そのため不要なVPCネットワークを削除すれば上記のコマンドが成功します。

Creating the network datalab-network

ERROR: (gcloud.compute.networks.create) Could not fetch resource:
 - Quota 'NETWORKS' exceeded.  Limit: 5.0 globally.

A nested call to gcloud failed, use --verbosity=debug for more info.
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?