You need to export a Cloud SQL for MySQL database instance to a Cloud Storage bucket for offline archiving using Google Cloud CLI tools. In what order should you execute the steps to complete this operation?
- 1Create a target Cloud Storage bucket to hold the database dump file.
- 2Grant the Cloud SQL instance service account the Storage Object Admin role on the Cloud Storage bucket.
- 3Execute the `gcloud sql export sql` command specifying the database instance and the Cloud Storage URI destination.
Answer
The correct order of operations is: first, create the target Cloud Storage bucket; second, grant the Cloud SQL instance service account write permissions on the bucket; third, execute the `gcloud sql export sql` command.
Exporting data from Cloud SQL to Cloud Storage requires preparing the storage destination prior to initiating the export command. First, the destination bucket must exist. Second, because Cloud SQL performs exports using the instance service account identity, that account must be granted Storage Object Admin permissions on the target bucket. Finally, the user runs `gcloud sql export sql` to execute the export.
Step-by-Step Solution
Key Concept
Cloud SQL data export procedures and IAM authorization requirements