PROFESSIONAL-CLOUD-DEVELOPER · Question #37
You are planning to migrate a MySQL database to the managed Cloud SQL database for Google Cloud. You have Compute Engine virtual machine instances that will connect with this Cloud SQL instance. You d
The correct answer is A. Enable private IP for the Cloud SQL instance.. Enabling private IP on the Cloud SQL instance (A) is the correct solution. When Cloud SQL has a private IP, it is assigned an IP address within your VPC network, allowing Compute Engine instances in the same VPC to connect to it using private RFC 1918 addresses without any IP whi
Question
You are planning to migrate a MySQL database to the managed Cloud SQL database for Google Cloud. You have Compute Engine virtual machine instances that will connect with this Cloud SQL instance. You do not want to whitelist IPs for the Compute Engine instances to be able to access Cloud SQL. What should you do?
Options
- AEnable private IP for the Cloud SQL instance.
- BWhitelist a project to access Cloud SQL, and add Compute Engine instances in the whitelisted
- CCreate a role in Cloud SQL that allows access to the database from external instances, and
- DCreate a CloudSQL instance on one project. Create Compute engine instances in a different
How the community answered
(40 responses)- A73% (29)
- B5% (2)
- C15% (6)
- D8% (3)
Explanation
Enabling private IP on the Cloud SQL instance (A) is the correct solution. When Cloud SQL has a private IP, it is assigned an IP address within your VPC network, allowing Compute Engine instances in the same VPC to connect to it using private RFC 1918 addresses without any IP whitelisting or public internet exposure. This is secure, performant, and requires no per-instance IP management. Whitelisting a project (B) still requires managing authorized networks. Creating a Cloud SQL role for external access (C) does not eliminate the need for network-level IP authorization. Separating Cloud SQL and Compute Engine into different projects (D) adds complexity and does not remove the need for IP-based access control.
Topics
Community Discussion
No community discussion yet for this question.