Soru

Zorluk: OrtaManaging Storage and Database Solutions

A Cloud Engineer needs to import data into a Cloud SQL for MySQL instance from a SQL dump file stored in a Google Cloud Storage bucket using the gcloud command-line interface. Which sequence of steps represents the correct procedure to execute this operation successfully?

  1. 1Identify the service account email address assigned to the Cloud SQL instance using gcloud sql instances describe.
  2. 2Grant the Storage Object Viewer role (roles/storage.objectViewer) to the Cloud SQL service account on the GCS bucket containing the SQL dump file.
  3. 3Execute the gcloud sql import sql command referencing the target Cloud SQL instance and the GCS URI of the dump file.
  4. 4Monitor the import operation using gcloud sql operations list to verify successful completion.

Cevap

The correct operational sequence begins by retrieving the Cloud SQL instance service account identity, granting that service account the Storage Object Viewer IAM role on the GCS bucket, running the gcloud sql import sql command, and finally verifying the asynchronous operation status.
To import data into Cloud SQL from Cloud Storage, the Cloud SQL instance's managed service account must first be retrieved and granted read permissions on the bucket. Only after IAM permissions are in place can the gcloud sql import sql command succeed, followed by checking operation status for completion.

Adım Adım Çözüm

1
Retrieve Cloud SQL Service Account Identity
Obtained the auto-generated service account email address for the Cloud SQL instance.
Cloud SQL accesses Google Cloud Storage using its own dedicated service account identity rather than user credentials.
2
Assign IAM Bucket Permissions
Assigned roles/storage.objectViewer to the Cloud SQL service account on the destination Cloud Storage bucket.
Cloud SQL requires read access to the GCS object to process the SQL dump during import.
3
Run Database Import Command
Initiated the import job via gcloud sql import sql INSTANCE_NAME gs://BUCKET_NAME/DUMP_FILE.sql.
This tells Cloud SQL to read the dump file from GCS and load the data into the database instance.
4
Verify Operation Status
Confirmed that the import operation reached DONE status without errors.
Import operations run asynchronously in GCP, so verification confirms the database state is updated.

Anahtar Kavram

Cloud SQL Data Import Procedures and IAM Authorization
Bu soruyu puanla