Question

Difficulty: HardDeploying and Configuring Managed Database Instances

A lead cloud engineer needs to deploy a new production Cloud SQL for PostgreSQL database instance named `analytics-db` in the `us-east1` region using the `gcloud` CLI. Corporate security policies require that the database instance communicate exclusively over private IP addresses within a Virtual Private Cloud (VPC) named `production-vpc`, and that no public IPv4 address is assigned to the database instance. Which `gcloud` command correctly deploys the database instance to satisfy these security and network requirements?

  1. gcloud sql instances create analytics-db --database-version=POSTGRES_15 --tier=db-custom-4-16384 --region=us-east1 --network=projects/my-project/global/networks/production-vpc --no-assign-ipAnswer
  2. B
    gcloud sql instances create analytics-db --database-version=POSTGRES_15 --tier=db-custom-4-16384 --region=us-east1 --network=projects/my-project/global/networks/production-vpc --assign-ip
  3. C
    gcloud sql instances create analytics-db --database-version=POSTGRES_15 --tier=db-custom-4-16384 --region=us-east1 --authorized-networks=0.0.0.0/0
  4. D
    gcloud bigtable instances create analytics-db --cluster=analytics-c1 --cluster-zone=us-east1-a --cluster-num-nodes=3 --instance-type=PRODUCTION

Answer

The command 'gcloud sql instances create analytics-db --database-version=POSTGRES_15 --tier=db-custom-4-16384 --region=us-east1 --network=projects/my-project/global/networks/production-vpc --no-assign-ip' correctly provisions the private Cloud SQL instance without a public IP.
The option specifying `--network=projects/my-project/global/networks/production-vpc` and `--no-assign-ip` is correct because `--network` connects the Cloud SQL instance to the VPC network via Private Service Access, and `--no-assign-ip` explicitly prevents Google Cloud from assigning a public IPv4 address to the instance.

Step-by-Step Solution

1
Identify database engine requirements
Cloud SQL for PostgreSQL requires using the `gcloud sql instances create` command group.
The scenario requires a managed PostgreSQL relational database instance.
2
Configure network and private IP flags
Pass `--network=projects/my-project/global/networks/production-vpc` to specify the private VPC.
Connecting Cloud SQL to a private network requires establishing private service access via the `--network` parameter.
3
Enforce zero public IP exposure
Include the `--no-assign-ip` flag in the provisioning command.
By default, Cloud SQL assigns a public IP unless explicitly suppressed with `--no-assign-ip`.

Key Concept

Deploying Cloud SQL instances with Private IP connectivity and suppressing public IP allocation via the gcloud CLI
Rate this question