You can create an instance with the gcloud command-line tool or with the Google Cloud Platform Console.
Use the gcloud spanner instances create command:
gcloud spanner instances create [INSTANCE-ID] --config=[INSTANCE-CONFIG] \
--description="[INSTANCE-NAME]" --nodes=[NODE-COUNT]
Provide the following values:
-
[INSTANCE-ID]: A permanent identifier that is unique within your Google Cloud Platform project. You cannot change the instance ID later.
-
[INSTANCE-CONFIG]: The instance configuration, which defines the geographic location of the instance's nodes and affects how data is replicated.
-
[INSTANCE-NAME]: The name to display for the instance in the GCP Console. The instance name must be unique within your Google Cloud Platform project.
-
[NODE-COUNT]: The number of nodes for the instance. The number of nodes determines 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 a message similar to the following example:
Creating instance...done.