Google Professional Cloud Database Engineer Question 258
Single answerGoogle Cloud PlatformYou are a database engineer for a company that needs to automate the provisioning of Cloud SQL instances for multiple environments (development, staging, and production). The instances must comply with specific configurations such as machine types, database versions, and high availability settings. Which solution should you implement to achieve this?
- A
Use Google Cloud Deployment Manager with a YAML configuration file to define and deploy Cloud SQL instances.
- B
Manually create Cloud SQL instances in the Google Cloud Console for each environment.
- C
Write a Python script using the Cloud SQL Admin API to programmatically create instances with the required configurations.
- D
Use gcloud CLI commands in a shell script to create and configure Cloud SQL instances.
Show answer and explanation
Correct answer: A
Explanation
Google Cloud Deployment Manager is a declarative infrastructure-as-code tool that allows you to automate the provisioning of resources, including Cloud SQL instances, using YAML configuration files. This approach is best suited for automating database instance provisioning because it enables you to define configurations once and replicate them consistently across multiple environments. It is more reliable and maintainable than imperative methods such as scripting with gcloud CLI or manually managing resources.
- A. Correct.
This is the correct approach because Google Cloud Deployment Manager allows you to automate the creation and configuration of resources, including Cloud SQL instances, using declarative YAML templates. It ensures consistent configurations across environments.
- B. Incorrect.
This is not a feasible solution because manually creating instances is prone to human error, time-consuming, and not scalable for automating provisioning.
- C. Incorrect.
While using the Cloud SQL Admin API can automate the process, it requires custom script development and maintenance, making it less efficient compared to Deployment Manager.
- D. Incorrect.
Using gcloud CLI in a shell script can automate the process, but it involves imperative commands which are more error-prone and less maintainable compared to the declarative approach of Deployment Manager.