Google Professional Cloud Database Engineer Question 254
Single answerGoogle Cloud PlatformYou are a database engineer tasked with automating the provisioning of Cloud SQL instances for a new project. The project team requires that the instances are created with consistent configurations such as machine type, storage size, and database version. Which approach should you use to ensure the provisioning process is automated and repeatable?
- A
Use Deployment Manager templates to define and deploy the Cloud SQL instances.
- B
Manually create Cloud SQL instances using the Google Cloud Console and document the steps for future use.
- C
Write a Python script using the Cloud SQL Admin API to programmatically create instances.
- D
Utilize Terraform to define the Cloud SQL instances as infrastructure-as-code.
Show answer and explanation
Correct answer: D
Explanation
Terraform is the best option for automating database instance provisioning because it supports infrastructure-as-code principles, allowing you to define and manage Cloud SQL instances in a repeatable and consistent manner. While other methods like Deployment Manager or custom scripts can be used, Terraform is more widely adopted, easier to use for this purpose, and integrates well with Google Cloud.
- A. Incorrect.
Deployment Manager can automate infrastructure provisioning, but it is less commonly used compared to Terraform for defining infrastructure-as-code, especially for database provisioning.
- B. Incorrect.
Manually creating instances does not ensure automation or repeatability, as the process relies on human intervention and is prone to errors.
- C. Incorrect.
While using the Cloud SQL Admin API with a Python script can achieve automation, managing configurations and ensuring repeatability is more complex compared to using infrastructure-as-code tools like Terraform.
- D. Correct.
Terraform is a widely used infrastructure-as-code tool that allows you to define Cloud SQL instances declaratively. It ensures configurations are consistent, version-controlled, and repeatable.