Quickstart: Creating a New Instance Using the Command Line

This page shows you how to create a new instance of a Deep Learning VM using a command-line interface.

Before you begin

  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account.

  2. In the Cloud Console, on the project selector page, select or create a Google Cloud project.

    Go to the project selector page

  3. Make sure that billing is enabled for your Google Cloud project. Learn how to confirm 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:

  1. Download and install the Cloud SDK using the instructions given on Installing Google Cloud SDK.
  2. Initialize the SDK using the instructions given on Initializing Cloud SDK.

To use gcloud in Cloud Shell for this quickstart, first activate Cloud Shell using the instructions given on Starting Cloud Shell.

Create a new instance

These instructions create a Deep Learning VM instance with the following parameters:

  • Using a TensorFlow on CUDA 9.2 image: tf-latest-cu92.
  • In the US West1-B zone: us-west1-b.
  • Named my-new-instance.
  • Of the instance type n1-standard-8.
  • Using an NVIDIA Tesla V100 GPU: type=nvidia-tesla-v100,count=8.
  • With a boot disk of 120 GB.
  • With an NVIDIA GPU driver set to install on first run: install-nvidia-driver=True.

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 gcloud 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

The stop command performs a clean shutdown.

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

The start command starts a stopped virtual machine instance.

Clean up

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

The delete command deletes Compute Engine instances.

What's next

Was this page helpful? Let us know how we did:

Send feedback about...

Deep Learning VM
Need help? Visit our support page.