This page shows you how to create a new instance of a Deep Learning VM using a command-line interface.
Before you begin
- 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 Cloud project. Learn how to confirm that billing is enabled for your project.
To use the
gcloud command-line tool for this quickstart, you must first
install and initialize the Cloud SDK:
- Download and install the Cloud SDK using the instructions given on Installing Google Cloud SDK.
- Initialize the SDK using the instructions given on Initializing Cloud SDK.
gcloud in Cloud Shell for this quickstart, first activate
Cloud Shell using the instructions given on Starting Cloud
Create a new instance
These instructions create a Deep Learning VM instance with the following parameters:
- Using a TensorFlow on CUDA 9.2 image:
- In the US West1-B zone:
- Of the instance type
- Using an NVIDIA Tesla V100 GPU:
- With a boot disk of 120 GB.
- With an NVIDIA GPU driver set to install on first run:
At the command line, enter the following:
export IMAGE_FAMILY="tf-latest-cu92" export ZONE="us-west1-b" export INSTANCE_NAME="my-new-instance" export INSTANCE_TYPE="n1-standard-8" gcloud compute instances create $INSTANCE_NAME \ --zone=$ZONE \ --image-family=$IMAGE_FAMILY \ --image-project=deeplearning-platform-release \ --maintenance-policy=TERMINATE \ --accelerator="type=nvidia-tesla-v100,count=8" \ --machine-type=$INSTANCE_TYPE \ --boot-disk-size=120GB \ --metadata="install-nvidia-driver=True"
After some time, the VM instance is created and a summary of its configuration is shown.
You've just created your first instance of a Deep Learning VM. To
verify the instance and see its status, use the
list command as shown here
to list all instances:
gcloud compute instances list
This displays all Compute Engine instances from all zones in the current project.
You can also view and maintain your Deep Learning VM instance on the Google Cloud Console in Compute Engine VM instances.
To view the status of just this instance:
gcloud compute instances describe $INSTANCE_NAME
Access your new instance
After you've created your Deep Learning VM instance, it starts automatically. You can access it using SSH using the following command:
gcloud compute ssh $INSTANCE_NAME
Compute Engine will propagate your SSH keys and create your user. For more information, see Connecting to Instances.
Stop the instance
Run the following command from your local machine (not on the instance):
gcloud compute instances stop $INSTANCE_NAME
stop command performs a
Start the instance
After the instance is initially created, Compute Engine starts it. To start the instance manually when it's stopped, run the following command:
gcloud compute instances start $INSTANCE_NAME
start command starts a
stopped virtual machine instance.
To avoid incurring charges to your Google Cloud account for the resources used in this quickstart, follow these steps.
To delete the Deep Learning VM instance that you created, at the command line, enter the following command:
gcloud compute instances delete $INSTANCE_NAME
delete command deletes
Compute Engine instances.