A Cloud Engineer is tasked with provisioning a Cloud SQL for MySQL database instance that must communicate exclusively using a Private IP address within an existing custom VPC network named `prod-vpc`. Security policy strictly prohibits assigning public IP addresses. In what order should the engineer execute the configuration and deployment steps to establish Private Service Access and successfully create the database instance?
- 1Allocate an IP address range for Private Service Access in `prod-vpc` using the `gcloud compute addresses create` command with `--purpose=VPC_PEERING`.
- 2Establish a private service connection between `prod-vpc` and Google services using the `gcloud services vpc-peerings connect` command.
- 3Deploy the Cloud SQL instance using `gcloud sql instances create` with the `--network=prod-vpc` and `--no-assign-ip` flags.
- 4Create the application database schema container using the `gcloud sql databases create` command.
Answer
The correct sequence begins with allocating an IP address range for VPC peering, followed by establishing the private service connection, then creating the Cloud SQL instance with `--no-assign-ip`, and finally creating the database on the instance.
Configuring Cloud SQL with Private IP requires establishing a Private Service Access connection first. This is a prerequisite two-step process: allocating an IP range (`gcloud compute addresses create ... --purpose=VPC_PEERING`) and creating the peering connection (`gcloud services vpc-peerings connect`). Only after this network foundation is in place can the instance be created with `--network` and `--no-assign-ip`. Logical database creation follows instance provisioning.
Step-by-Step Solution
Key Concept
Deploying Cloud SQL with Private IP via Private Service Access