Creating and Managing Instances

This page describes how to create, list, edit, delete Cloud Spanner instances. To learn more about instances, see Instances.

Creating an instance

You can create an instance on the command line using the gcloud command-line tool or through the Google Cloud Platform Console.

Console

  1. Go to the Spanner page in the GCP Console.
    Go to the Spanner page
  2. Click Create instance.
  3. In the instance creation dialog, specify:

    • An Instance name (display name). This value must be unique for the Google Cloud Platform project.
    • An Instance ID. The instance ID must also be unique for the project and cannot be changed.
    • A Configuration, which defines the geographic placement and replication of the nodes in your instance.
    • The number of Nodes for this instance. The number of nodes corresponds to the amount of serving and storage resources that are available to databases in the instance.
  4. Click Create to create your instance.

Here is an example of what the instance creation page looks like:

Screenshot of the instance creation window

gcloud

Use the gcloud spanner instances create command, replacing [VALUES_IN_BRACKETS] with the appropriate values:

gcloud spanner instances create [INSTANCE-ID] --config=[INSTANCE-CONFIG] \
--description="[INSTANCE-NAME]" --nodes=[NODE-COUNT]

where:

  • [INSTANCE-ID]: an identifier that must be unique for the Google Cloud Platform project. This ID cannot be changed.
  • [INSTANCE-CONFIG]: an instance configuration, which defines the geographic placement and replication of the data in your instance.
  • [INSTANCE-NAME]: a display name for the instance that must be unique for the Google Cloud Platform project.
  • [NODE-COUNT]: the number of nodes for this instance. The node count corresponds to the amount of serving and storage resources that are available to databases in the instance.

For example:

gcloud spanner instances create test-instance --config=regional-us-central1 \
--description="Test Instance" --nodes=1

You should see:

Creating instance...done.

Listing instances

Console

Go to the Spanner Instances page in the GCP Console.
Go to the Spanner Instances page

You should see a list of your Cloud Spanner instances, along with their id, display name, configuration, and the number of nodes in the instance.

gcloud

gcloud spanner instances list

You should see a list of your Cloud Spanner instances, along with their display name, configuration, and the number of nodes in the instance.

Editing an instance

Changing the display name

Console

  1. Go to the Spanner Instances page in the GCP Console.
    Go to the Spanner Instances page
  2. Click the name of the instance that you want to rename.
  3. Click Edit instance.
  4. Specify a new Instance name. This name must be unique for the Google Cloud Platform project.
  5. Click Save.

gcloud

gcloud spanner instances update [INSTANCE-ID] --description [INSTANCE-NAME]

Changing an instance configuration

You cannot change the configuration of an existing instance.

Changing the number of nodes

Console

  1. Go to the Spanner Instances page in the GCP Console.
    Go to the Spanner Instances page
  2. Click the name of the instance that you want to change the node count of.
  3. Click Edit Instance.
  4. Specify the desired number of Nodes.
    Note that if you want to increase the number of nodes in the instance, your Google Cloud Platform project must have enough nodes to distribute to this instance. If you see a note that you have insufficient nodes in this location, follow the instructions to request more nodes before proceeding.
  5. Click Save.

gcloud

gcloud spanner instances update [INSTANCE-ID] --nodes [NODE-COUNT]

Note that if you want to increase the number of nodes in the instance, your Google Cloud Platform project must have enough nodes to distribute to this instance.

Deleting an instance

Console

  1. Go to the Spanner Instances page in the GCP Console.
    Go to the Spanner Instances page
  2. Click the name of the instance that you want to delete.
  3. Click Delete instance.
  4. Follow the instructions to confirm deletion.
  5. Click Delete.

Deleting an instance permanently removes the instance and all its databases. You cannot undo this later.

gcloud

gcloud spanner instances delete [INSTANCE-ID]

Deleting an instance permanently removes the instance and all its databases. You cannot undo this later.

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

Send feedback about...

Cloud Spanner Documentation