A cloud engineer needs to deploy a Cloud SQL PostgreSQL instance named 'prod-db' in a custom Virtual Private Cloud (VPC) named 'app-vpc'. Security policies require that the database is accessible strictly using a Private IP address without any public IP assigned. What is the correct sequence of steps required to set up Private Services Access and provision the instance?
- 1Reserve an internal IP range in 'app-vpc' using gcloud compute addresses create with the --purpose=VPC_PEERING flag.
- 2Establish a private connection using gcloud services peered-connections create to peer 'app-vpc' with Google services.
- 3Provision the Cloud SQL instance using gcloud sql instances create with the --network=app-vpc and --no-assign-ip flags.
- 4Connect to the internal IP of the Cloud SQL instance from a Virtual Machine inside 'app-vpc' to initialize database schemas.
Cevap
The correct order of steps is: 1) Reserve an internal IP range in the VPC using the VPC_PEERING purpose flag, 2) Establish a private connection to Google services via service peering, 3) Provision the Cloud SQL instance specifying the VPC network and disabling public IP assignment, and 4) Connect from an internal VM within the VPC to initialize database schemas.
To deploy a Cloud SQL instance with Private IP, Google Cloud requires setting up Private Services Access first. This involves reserving an internal IP address block in the VPC network (using purpose=VPC_PEERING), creating a VPC peering connection to the service producer network using gcloud services peered-connections create, provisioning the database instance with the --network and --no-assign-ip flags, and finally accessing the database from internal compute instances within the same VPC.
Adım Adım Çözüm
Anahtar Kavram
Configuring Private IP Connectivity for Cloud SQL using Private Services Access