Table of contents:
- Enable Google Compute Engine and Cloud Source Repositories APIs
- Launch a Datalab Instance from gcloud
- Open a notebook
- Shutting down/ Deleting the instance
Google Cloud datalab provides an interactive environment (via Jupyter notebooks) for analyzing data and designing machine learning models. Datalab is actually hosted on a Google Compute Engine with an attached disk capacity for storing the Jupyter notebooks.
In this piece, we’ll be launching Cloud Datalab for machine learning design using the gcloud command-line console.
Enable Google Compute Engine and Cloud Source Repositories APIs
On a new account, first, enable Google Compute API and then the Cloud Source Repositories API before launching datalab.
Enable Cloud Compute Engine API
Enable Cloud Source Repositories API
Launch a Datalab Instance from gcloud
Working with the gcloud console allows us to interact with Google Cloud resources using the command-line directly from the browser. This tool is very convenient because the user need not install the Google Cloud SDK on the local machine. The gcloud feature allows users of low-end computers to do a lot of resource interaction directly within the cloud perimeter.
To launch a datalab instance,
- Open gcloud shell
- Create a datalab instance by running the command datalab create instance-name
- Accept all the defaults as the instance is provisioned
- Press Enter twice when asked to generate a passphrase.
- Click on the Web Preview at top-right of the gcloud window, click Change port and selet Port 8081, to start using Datalab.
Note: The instance-name must begin with a lowercase letter, and can have up to 63 lowercase letters, mixed with numbers and hyphens. The instance-name cannot end with a hyphen.
Open a notebook
To open a new notebook. Click on New Notebook at the top-left hand corner of the instance page.
Shutting down/ Deleting the instance
To shut down the instance,
- Open the Cloud Compute Dashboard
- Click the check-box to select the instance.
- Click Stop to shut down the instance. Shutting down the instance prevents the user from incurring unnecessary cost when the instance is not in use.
- Click Delete to delete the instance and detach the disk allocated to the compute engine. Only use this action when completely done with all work on that instance. This action is irreversible.