CLOUD-DATABASE-ENGINEER practice question 7 of 25

You finished migrating an on-premises MySQL database to Cloud SQL. You want to ensure that the daily export of a table, which was previously a cron job running on the database server, continues. You want the solution to minimize cost and operations overhead. What should you do?

Full set: 141 questions
Answer options
A: Use Cloud Scheduler and Cloud Functions to run the daily export. Correct answer
B: Create a streaming Datatlow job to export the table.
C: Set up Cloud Composer, and create a task to export the table daily.
D: Run the cron job on a Compute Engine instance to continue the export.
Correct Answer:
A. Use Cloud Scheduler and Cloud Functions to run the daily export.
Explanation

This solution is the most cost-effective and operationally efficient. Cloud Scheduler is a fully managed cron service designed for triggering jobs on a schedule, directly replacing the on-premises cron functionality. Cloud Functions provides a serverless compute environment, meaning you only pay for the brief execution time of the export script. This serverless combination eliminates the need to manage and pay for a constantly running virtual machine, minimizing both cost and operational overhead, which directly aligns with the requirements.

Why Incorrect

B. A streaming Dataflow job is designed for continuous, real-time data processing, not for a scheduled daily batch export. This is the wrong tool and would be unnecessarily complex and costly.
C. Cloud Composer is a powerful workflow orchestration tool for complex, multi-step data pipelines (DAGs). Using it for a single, simple daily task is excessive and violates the principle of minimizing cost and overhead.
D. Using a Compute Engine instance replicates the on-premises model, requiring a virtual machine to run 24/7. This incurs unnecessary costs and operational overhead for patching, security, and management.

References

1. Cloud Scheduler and Cloud Functions Pattern: The official Google Cloud documentation provides a tutorial for this exact use case. It states, "This page shows how to use Cloud Scheduler to trigger a Cloud Function on a schedule." This pattern is recommended for running background jobs reliably.

Source: Google Cloud Documentation, "Schedule a Cloud Function to run with Cloud Scheduler".

2. Cloud Functions for Cost-Effectiveness: The Cloud Functions documentation highlights its serverless nature. "With Cloud Functions, you write simple, single-purpose functions... and you're only billed for the time your code runs, metered to the nearest 100 milliseconds." This directly supports the "minimize cost" requirement.

Source: Google Cloud Documentation, "What is Cloud Functions?".

3. Cloud SQL Export API: The Cloud Function would call the Cloud SQL Admin API to perform the export. This is a standard, supported method for programmatically managing database operations.

Source: Google Cloud Documentation, "Cloud SQL Admin API v1beta4, instances: export".

4. Cloud Composer Use Case: The Cloud Composer documentation clarifies its purpose: "Cloud Composer is a fully managed workflow orchestration service... for creating, scheduling, monitoring, and managing workflows that span across clouds and on-premises data centers." This indicates it is for more complex scenarios than a single export task.

Source: Google Cloud Documentation, "Cloud Composer overview".

Scroll to Top