0
0
GCPcloud~30 mins

Cloud Spanner for global distribution in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Cloud Spanner for global distribution
📖 Scenario: You are building a globally distributed application that requires a highly available and scalable database. Google Cloud Spanner is a perfect choice because it offers strong consistency and global distribution.In this project, you will create a Cloud Spanner instance, configure a database with a table, and set up multi-region replication to ensure your data is available worldwide.
🎯 Goal: Create a Cloud Spanner instance with a multi-region configuration, define a database schema with a table, and configure the instance for global distribution.
📋 What You'll Learn
Create a Cloud Spanner instance named global-instance with a multi-region configuration nam6 (North America multi-region).
Create a database named customer-db inside the instance.
Define a table named Customers with columns CustomerId (STRING(36), primary key), Name (STRING(100)), and Country (STRING(50)).
Configure the instance to use 3 nodes for capacity.
💡 Why This Matters
🌍 Real World
Global applications like e-commerce, financial services, and gaming require databases that are fast, consistent, and available worldwide. Cloud Spanner provides this capability with multi-region replication.
💼 Career
Cloud architects and database administrators use Cloud Spanner to design scalable, globally distributed databases that support mission-critical applications with strong consistency and high availability.
Progress0 / 4 steps
1
Create Cloud Spanner instance
Create a Cloud Spanner instance named global-instance with the configuration nam6 and 3 nodes.
GCP
Need a hint?

Use the gcloud spanner instances create command with the correct instance name, configuration, and node count.

2
Create Cloud Spanner database
Create a database named customer-db inside the Cloud Spanner instance global-instance.
GCP
Need a hint?

Use the gcloud spanner databases create command with the correct database name and instance.

3
Define Customers table schema
Define a table named Customers with columns CustomerId (STRING(36), primary key), Name (STRING(100)), and Country (STRING(50)) using a DDL statement. Use the gcloud spanner databases ddl update command to apply this schema to the customer-db database in the global-instance instance.
GCP
Need a hint?

Use the gcloud spanner databases ddl update command with a DDL string to create the table.

4
Verify instance configuration for global distribution
Verify that the Cloud Spanner instance global-instance is configured with the multi-region configuration nam6 and has 3 nodes allocated.
GCP
Need a hint?

Use the gcloud spanner instances describe command to check the instance details.