An operations engineer needs to export a production database from a Cloud SQL for MySQL instance to a Google Cloud Storage bucket using the gcloud CLI. The process must follow Google Cloud security best practices by granting the minimum required service account permissions. What is the correct sequence of steps to perform this export operation successfully?
- 1Retrieve the auto-generated service account address associated with the Cloud SQL instance using `gcloud sql instances describe`.
- 2Grant the Cloud SQL service account the `roles/storage.objectAdmin` role on the target Cloud Storage bucket.
- 3Execute the `gcloud sql export sql` command, specifying the instance name and the target `gs://` bucket URI.
- 4Verify the operational status of the export task using `gcloud sql operations list` and confirm the file presence in Cloud Storage.
Answer
The correct operational sequence begins by retrieving the service account email of the Cloud SQL instance, granting that service account the Storage Object Admin role on the Cloud Storage destination bucket, running the gcloud sql export command, and finally verifying the completed operation status and bucket contents.
Exporting data from Cloud SQL to Cloud Storage requires proper delegation of authority. First, you must identify the Cloud SQL service account associated with the instance. Second, that service account must be granted write access (roles/storage.objectAdmin) on the destination Cloud Storage bucket. Third, you execute the gcloud sql export sql command. Fourth, you inspect the operation completion status to confirm successful export.
Step-by-Step Solution
Key Concept
Cloud SQL Database Export Procedures and IAM Service Account Authorization