Member-only story

How to Automate the creation of Spanner instances and databases using Terraform

Komal Agrawal
2 min readNov 7, 2023

Cloud Spanner is a fully managed, mission-critical, relational database service that offers transactional consistency at a global scale, automatic, synchronous replication for high availability, and support for two SQL dialects: GoogleSQL and PostgreSQL.

To use Spanner, you must first create a Spanner instance within your Google Cloud project. This instance is an allocation of resources that is used by Spanner databases created in that instance.

Instance creation includes two important choices:

  • The instance configuration
  • The compute capacity.

These choices determine the location and amount of the instance’s serving and storage resources.

Terraform

Terraform is a tool for building, changing, and versioning infrastructure.

It uses configuration files to describe the components needed to run a single application or your entire infrastructure.

Using Terraform, we can Automate the creation of Spanner instances and databases

Terraform and Cloud Sapnner logo

In the below video, you will learn how to

  • Create instances and databases using the gcloud CLI.

--

--

Komal Agrawal
Komal Agrawal

Written by Komal Agrawal

Test Engineer @HCLTech, GCP DevOps Certified, Reader & Writer

Responses (1)