I'm trying to create a Jupyter notebook on AI platform (https://cloud.google.com/ai-platform/notebooks/docs/create-new) using devops pipeline and for that i need gcloud command to create a Jupyter notebook but i couldn't find out on GCP documentation. can some one help here?
Asked
Active
Viewed 681 times
2 Answers
2
The command not yet exists. You can create a datalab VM if you want. If you really want to use the notebook out of datalab environment, I dug into it.
In my browser, I activated the developer mode, I went to network section and I created a notebook instance. I caught this in the post HTTP post
URL:
https://clients6.google.com/compute/v1/projects/gbl-imt-homerider-basguillaueb/zones/us-west1-b/instances?key=<API KEY>
Post Content:
{
"name": "tensorflow-20190925-144402",
"machineType": "zones/us-west1-b/machineTypes/n1-standard-4",
"guestAccelerators": [],
"metadata": {
"items": [
{
"key": "proxy-mode",
"value": "service_account"
}
]
},
"disks": [
{
"boot": true,
"autoDelete": true,
"initializeParams": {
"diskType": "zones/us-west1-b/diskTypes/pd-standard",
"diskSizeGb": "100",
"sourceImage": "projects/deeplearning-platform-release/global/images/family/tf-1-14-cu100-notebooks"
}
}
],
"scheduling": {
"onHostMaintenance": "TERMINATE"
},
"networkInterfaces": [
{
"subnetwork": "https://www.googleapis.com/compute/v1/projects/gbl-imt-homerider-basguillaueb/regions/us-west1/subnetworks/datalab-network",
"accessConfigs": [
{
"name": "external-nat",
"type": "ONE_TO_ONE_NAT"
}
]
}
],
"serviceAccounts": [
{
"email": "default",
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/userinfo.email"
]
}
],
"tags": {
"items": [
"deeplearning-vm"
]
}
}
I translated this in a gcloud
command line. Only the NAT part isn't present, I don't know the impact and how to do this in command line
gcloud beta compute instances create test --zone=us-west1-b --machine-type="n1-standard-4" \
--boot-disk-type="pd-standard" --boot-disk-size=100 \
--image="projects/deeplearning-platform-release/global/images/family/tf-1-14-cu100-notebooks" \
--metadata="proxy-mode=service_account" --tags=deeplearning-vm --boot-disk-auto-delete \
--maintenance-policy=TERMINATE --scopes="https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/userinfo.email"
I tested the deployment, it works and the VM appears in the notebook section. I hope this help.

guillaume blaquiere
- 66,369
- 2
- 47
- 76
-
About the NAT part, everything should be fine since it is using the default network. It is possible to check this by going to the logs and searching for the creation log, there you'll see that the newly created instance is using the `ONE_TO_ONE_NAT` – Miguel Sep 25 '19 at 14:47
-
Thanks @Miguel. Default behavior save me! – guillaume blaquiere Sep 25 '19 at 14:56
0
You should run this command:
gcloud beta dataproc clusters create <cluster-name> \
--optional-components=ANACONDA,JUPYTER \
--image-version=1.3 \
--enable-component-gateway \
--bucket <bucket-name> \
--project <project-id>
Before running the command, please take a look at this tutorial to make sure you have set up your environment correctly.

Miguel
- 956
- 6
- 20
-
This will create noteboook on dataproc i'm trying to create on AI platform. Sorry, just edited the question. – Vivek Sep 25 '19 at 11:20