An operations engineer needs to restore a PostgreSQL database backup file stored in a Google Cloud Storage bucket into a target Cloud SQL for PostgreSQL instance using the gcloud CLI. Place the following operational steps in the correct chronological sequence to perform this restoration.
- 1Retrieve the service account email address of the Cloud SQL instance using `gcloud sql instances describe`.
- 2Grant the Cloud SQL instance service account the `roles/storage.objectViewer` IAM role on the source Cloud Storage bucket.
- 3Execute the `gcloud sql import sql` command referencing the target instance name and the `gs://` URI of the database backup file.
- 4Monitor the asynchronous import process using `gcloud sql operations list` until the operation status reaches `DONE`.
Cevap
The correct operational sequence is: 1) Retrieve the service account email of the Cloud SQL instance, 2) Grant the service account the Storage Object Viewer role on the Cloud Storage bucket, 3) Execute the gcloud sql import sql command with the Cloud Storage URI, and 4) Monitor the operation status using gcloud sql operations list until DONE.
To perform a Cloud SQL import from Cloud Storage, the instance service account must first be retrieved and granted read permissions (Storage Object Viewer) on the bucket containing the dump file. Only after permission propagation can the `gcloud sql import sql` command be executed, followed by monitoring the operation status via `gcloud sql operations list` to confirm successful completion.
Adım Adım Çözüm
Anahtar Kavram
Cloud SQL Database Import IAM Prerequisites and CLI Execution Sequence