Question

Difficulty: MediumDeploying and Configuring Managed Database Instances

A cloud engineer needs to configure Private Service Access and deploy a Cloud SQL PostgreSQL database instance with Private IP connectivity in a custom Virtual Private Cloud (VPC) network using the `gcloud` command-line interface. Sequence the required steps in the correct chronological order from first to last.

  1. 1Allocate an internal IP address range in the target VPC network using `gcloud compute addresses create`.
  2. 2Establish a private connection between the VPC network and Google services using `gcloud services peered-connect-services create`.
  3. 3Provision the Cloud SQL PostgreSQL instance using `gcloud sql instances create` with `--network` and `--no-assign-ip` flags.
  4. 4Create an initial database user account on the Cloud SQL instance using `gcloud sql users create`.

Answer

The correct sequence of steps is: 1) Allocate an internal IP address range in the VPC network, 2) Establish a private connection (VPC Network Peering) to Google services, 3) Provision the Cloud SQL PostgreSQL instance with `--network` and `--no-assign-ip`, and 4) Create an initial database user account on the instance.
To provision a Cloud SQL database instance exclusively on Private IP, Google Cloud requires establishing Private Service Access beforehand. The deployment workflow strictly requires: first reserving an internal IP block in the target VPC, second creating the VPC network peering connection to servicenetworking.googleapis.com, third executing `gcloud sql instances create` with `--network` and `--no-assign-ip`, and finally managing database resources such as creating initial database users.

Step-by-Step Solution

1
Allocate an internal IP range
A named internal IP address allocation is created within the custom VPC network.
Google Cloud requires dedicated private IP space allocated within your VPC before connecting to managed services.
2
Connect the VPC network to Service Networking
A Private Service Access peering connection is created between the VPC and Google's internal service network.
Cloud SQL Private IP instances communicate with client VPCs over this private peering connection.
3
Deploy the Cloud SQL instance with Private IP
The Cloud SQL PostgreSQL instance is provisioned with a private IP address and no public IP assigned.
Passing `--network` attaches the instance to the peered VPC, while `--no-assign-ip` disables public endpoint exposure.
4
Configure database user credentials
A user credential account is created within the provisioned PostgreSQL instance.
Administrative database entities can only be instantiated after the underlying database engine is fully running.

Key Concept

Provisioning Cloud SQL Private IP via Private Service Access
Rate this question