A cloud engineer needs to deploy a highly available Cloud SQL PostgreSQL instance using Private IP connectivity within a custom Virtual Private Cloud (VPC) network, followed by creating a cross-region read replica using the Google Cloud CLI. Arrange the required infrastructure provisioning and database creation steps in the correct chronological execution order from first to last.
- 1Reserve an internal IP address range in the custom VPC network with the purpose set to VPC_PEERING using `gcloud compute addresses create`.
- 2Establish a private services access connection between the custom VPC network and Google services using `gcloud services vpc-peerings connect`.
- 3Provision the primary Cloud SQL PostgreSQL instance with `--availability-type=REGIONAL`, `--no-assign-ip`, and `--network` bound to the custom VPC network using `gcloud sql instances create`.
- 4Deploy a read replica instance in a secondary region specifying the `--master-instance-name` flag using `gcloud sql instances create`.
Answer
The correct sequence starts with reserving an internal IP allocation for VPC peering, establishing the private services access connection to servicenetworking.googleapis.com, creating the regional primary Cloud SQL instance attached to the VPC with public IP disabled, and finally creating the cross-region read replica targeting the primary instance.
Private IP connectivity for Cloud SQL relies on Private Services Access, which is built on VPC Peering between the customer VPC network and Google's internal service network. The workflow requires allocating an internal IP range (`gcloud compute addresses create ... --purpose=VPC_PEERING`), connecting the network to Service Networking (`gcloud services vpc-peerings connect`), provisioning the primary Cloud SQL instance (`gcloud sql instances create ... --no-assign-ip --network=...`), and finally creating any read replicas specifying the primary as the master instance.
Step-by-Step Solution
Key Concept
Provisioning Cloud SQL instances with Private IP requires establishing a Private Services Access (Service Networking VPC Peering) connection before instantiating primary instances or read replicas.