Fixing Cloud SQL "Network association failed" in a Shared VPC
Short answer
B Enable the Service Networking API in both the host and service projects before assigning private IPs to the Cloud SQL instances.
Question
Key Takeaways
The question tests recognition of a documented Cloud SQL error message; the trap is choosing Private Services Access setup instead of the API enablement the error actually names.
When Cloud SQL for PostgreSQL reports "Network association failed" while assigning a private IP over a shared VPC, the fix is enabling the Service Networking API in both the host and service projects (B).
Common mistake: Option C is the most tempting wrong answer: Private Services Access is a genuine prerequisite for private IP, but it is not what the "Network association failed" message indicates, and the question already implies an existing shared VPC setup.
Expert Analysis
The error name is the clue
The exact string "Network association failed" is a documented Cloud SQL error, and its official troubleshooting entry names one cause: the Service Networking API is not enabled. Because this deployment uses a shared VPC, the API must be enabled in both the host project (which owns the shared network) and the service project (which owns the Cloud SQL instance). That is precisely what option B says, so B is the correct answer.
Why option C is the attractive trap
Option C sounds authoritative because Private Services Access really is a prerequisite for private IP: you must allocate an address range and create a PSA connection before Cloud SQL can hand out an internal address. A candidate who has configured many private-IP instances will recognise that sequence and pick C. But the question does not report a missing-range or "no private services access connection" failure — it reports a network association failure, and the documented remedy for that message is enabling the Service Networking API. C describes normal setup order, not the fix for this specific error. Once the API is enabled in both projects, the association to the allocated range can complete; if PSA itself were absent, the failure would surface as a different error at connection-selection time.
Why A and D fail
Options A and D only change the tool used to issue the same request. The console and gcloud sql instances patch both call the same backend, so switching interfaces cannot repair a disabled API — the assignment fails identically either way.
Shared VPC nuance
Enabling the API only in the service project is a common half-fix; the host project must have it too, since the network association is created against the host's shared network.
Exam Strategy
On Google Cloud database exams, treat an exact error string as a lookup key: recall or reason to the official troubleshooting entry rather than general best practice. Eliminate options that only change the tool (console vs gcloud), since interface choice never fixes a backend or API-visibility problem. Then split prerequisite answers: ask whether the option addresses this specific error message or merely describes normal setup order, and prefer the one that names both the host and service projects when a shared VPC is mentioned.
Frequently Asked Questions
Why does "Network association failed" appear only with a shared VPC?
Is Private Services Access still required for Cloud SQL private IP?
Does switching between the console and gcloud fix the private IP error?
gcloud sql instances patch invoke the same backend operation, so a disabled Service Networking API fails identically regardless of which tool you use.Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 1 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 1
-
taskeen87 👍 1 Answered BExact Error Root Cause: As documented in the Cloud SQL Error Messages reference: Error Message: Network association failed. Troubleshooting: "The Service Networking API isn't enabled in the project. Enable the Service Networking API in your project. If you see this error when you're trying to assign a private IP address to a Cloud SQL instance, and you're using a Shared VPC, you also need to enable the Service Networking API for the host project."
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.