Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
You are deploying a high-concurrency Python web application on a Compute Engine VM that connects to a Cloud SQL for PostgreSQL instance in the same VPC network. Your security and performance requirements are as follows:
Which configuration should you implement?
5432 alongside PgBouncer, enforce SSL on the instance without configuring client SSL/TLS settings, and pass an OAuth 2.0 token generated once at startup with gcloud sql generate-login-token as the database password.Connecting directly to a Cloud SQL instance's private IP address on port 5432 bypasses the Cloud SQL Auth Proxy and Cloud SQL Language Connectors. Manual IAM database authentication uses gcloud sql generate-login-token to obtain a short-lived OAuth 2.0 access token that is supplied in place of a password.
gcloud sql generate-login-token does not automatically refresh the credential. Because IAM access tokens are short-lived, any new connections opened by PgBouncer or the application after the token expires will fail authentication.The application required the absolute lowest network latency over private IP, you were willing to manually manage server and client SSL/TLS certificates, and your application programmatically refreshed short-lived OAuth 2.0 tokens (or used built-in database passwords) rather than relying on a one-time startup token.
roles/cloudsql.client role to the VM, run the Cloud SQL Auth Proxy without an external pooler so the proxy's built-in connection pooling manages database connection limits, and allow egress TCP traffic on port 5432 to the instance's private IP.This configuration attempts to use the Cloud SQL Auth Proxy with only the roles/cloudsql.client role, relies on the proxy itself for connection pooling, omits the --private-ip flag, and opens egress firewall rules only for the native PostgreSQL port (5432).
roles/cloudsql.client grants cloudsql.instances.connect to authorize the proxy tunnel, logging into the database using IAM database authentication also requires cloudsql.instances.login, provided by the roles/cloudsql.instanceUser role.5432, but its outbound traffic to the Cloud SQL instance uses TCP port 3307 for the encrypted tunnel and TCP port 443 for Cloud SQL Admin API calls.--private-ip, the proxy defaults to attempting a public IPv4 connection rather than using the private IP address.443 and 3307 prevent the proxy from obtaining ephemeral certificates and opening its secure tunnel.roles/cloudsql.instanceUser causes IAM database login attempts to fail.There is no scenario where this exact setup works for IAM authentication over private IP, as the proxy never provides connection pooling and always requires egress on ports 443 and 3307 rather than 5432.
roles/cloudsql.editor role, enable Context-Aware Access with IAM database authentication, and run the Cloud SQL Auth Proxy with PgBouncer while allowing only egress TCP traffic on port 3307 without specifying --private-ip.This option combines a downloaded service account JSON key file with Context-Aware Access and IAM database authentication, while restricting outbound traffic to port 3307 and omitting the --private-ip startup flag.
3307 blocks outbound HTTPS connections on port 443 to sqladmin.googleapis.com. Without port 443, the proxy cannot request or refresh ephemeral SSL certificates or IAM tokens.--private-ip flag, the Cloud SQL Auth Proxy defaults to connecting over the instance's public IPv4 address rather than its private IP address.roles/cloudsql.editor grants overly broad permissions compared to roles/cloudsql.client and still omits roles/cloudsql.instanceUser.443 (sqladmin.googleapis.com) and port 3307 (instance proxy server) are mandatory egress ports for the proxy.A workload ran outside Google Cloud without metadata credentials, did not use Context-Aware Access, connected over public IP, opened both ports 443 and 3307, and used a least-privilege service account with roles/cloudsql.client and roles/cloudsql.instanceUser.
roles/cloudsql.client and roles/cloudsql.instanceUser roles to the VM, run the Cloud SQL Auth Proxy with the --private-ip flag and automatic IAM authentication, allow egress TCP traffic on ports 443 and 3307, and pair the proxy with a connection pooler such as PgBouncer.The Cloud SQL Auth Proxy is a client-side connector that establishes an authenticated, encrypted tunnel between an application environment and a Cloud SQL instance. IAM database authentication replaces static database passwords with short-lived OAuth 2.0 access tokens tied to Google Cloud IAM principals, such as a Compute Engine VM's attached service account.
--private-ip flag forces the proxy to route traffic over the VPC's private IP endpoint.sqladmin.googleapis.com) over HTTPS port 443 to fetch ephemeral SSL certificates that expire in roughly one hour and automatically refreshes them, encrypting all database traffic with TLS 1.3 over destination TCP port 3307.roles/cloudsql.client (granting cloudsql.instances.connect) and roles/cloudsql.instanceUser (granting cloudsql.instances.login) avoids static JSON key files and allows the proxy to automatically refresh OAuth 2.0 access tokens.This architecture satisfies every security, identity, networking, and performance requirement with minimal operational overhead. Using the VM's attached service account follows least-privilege identity best practices while keeping all database traffic private and pooled.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated