A cloud engineer needs to configure Private Service Access within a custom Virtual Private Cloud (VPC) network named `corp-vpc` and provision a high-availability Cloud SQL for MySQL instance hosting an application database named `sales_db`. What is the correct sequence of `gcloud` CLI operations required to successfully complete this deployment?
- 1Run `gcloud compute addresses create` with `--purpose=VPC_PEERING` to allocate an internal IP range in `corp-vpc`.
- 2Run `gcloud services vpc-peerings connect` targeting `--service=servicenetworking.googleapis.com` to establish VPC peering.
- 3Run `gcloud sql instances create` with `--network=corp-vpc` and `--no-assign-ip` to deploy the private Cloud SQL instance.
- 4Run `gcloud sql databases create sales_db` specifying the newly created Cloud SQL instance name.
Answer
The correct deployment sequence is: 1) Allocate an internal IP address range in the VPC network (`gcloud compute addresses create`), 2) Establish a VPC peering connection to Google services (`gcloud services vpc-peerings connect`), 3) Deploy the Cloud SQL instance configured with private IP (`gcloud sql instances create`), and 4) Create the logical database inside the provisioned instance (`gcloud sql databases create`).
Setting up a private Cloud SQL instance using Private Service Access requires four dependent steps in precise order: first, reserve a named IP address range inside the customer VPC network (`gcloud compute addresses create`); second, establish a peering connection between the VPC and `servicenetworking.googleapis.com` (`gcloud services vpc-peerings connect`); third, provision the Cloud SQL instance linked to that network while suppressing public IP (`gcloud sql instances create`); and finally, create the target database schema inside the active instance (`gcloud sql databases create`).
Step-by-Step Solution
Key Concept
Sequence of steps for establishing Private Service Access and deploying private Cloud SQL instances