Set up a Google Cloud project for TPUs

This topic describes how to set up your Google Cloud project to use Cloud TPU VMs:

Create a Google Cloud project

  1. In the Google Cloud console, sign in to your Google Account or sign up for a new account.

  2. Create a Google Cloud project. For more information, see Create a project.

  3. Enable billing for your Google Cloud project. For more information, see the Cloud Billing documentation.

    Billing for all Cloud TPU versions uses the standard regional pricing on the Cloud TPU pricing page.

Configure your Google Cloud project for Cloud TPU

You can configure your Google Cloud project using the Cloud Shell, a Compute Engine VM, or your local machine. The Cloud Shell lets you interact with TPU VMs without installing any software. The Cloud Shell disconnects after a period of inactivity. If you're running long-running commands, we recommend installing the Google Cloud CLI on your local machine. For more information on the Google Cloud CLI, see the gcloud Reference.

  1. If you are using a local machine or a Compute Engine VM, install the Google Cloud CLI. The Google Cloud CLI includes the gcloud command you use to work with Google Cloud resources and services.

  2. Configure the gcloud command to use your project.

    export PROJECT_ID=your-project-id
    gcloud config set project $PROJECT_ID
  3. Activate the Cloud TPU API using gcloud or the Google Cloud console:

    gcloud

    gcloud services enable tpu.googleapis.com
    

    Console

    1. In the Google Cloud console, go to the Cloud TPU API page.

      Go to Cloud TPU API

    2. Click Enable.

  4. Make sure your Google Cloud account has the following roles in your project:

    To view your current roles, see View current access.

    To add any missing roles, see Grant a single IAM role or ask your administrator to do it for you.

  5. Create a Cloud TPU service agent:

    A TPU service agent is a Google-managed service account that lets the Cloud TPU service create and manage resources in your Google Cloud project.

      gcloud beta services identity create --service tpu.googleapis.com \
      --project $PROJECT_ID
  6. Create a TPU service account:

    Service accounts provide credentials for your TPU VMs to access other Google Cloud resources. To improve security, create a user-managed service account that has only the permissions your TPU VM requires. To use it, specify the service account with the --service-account flag when you create the TPU VM.

    1. Follow the instructions in Create service accounts to create a user-managed service account.

    2. Grant your service account the following roles so your TPU VM can access common Google Cloud services:

What's next