A database administrator needs to allow an automated data extraction script, executing on a Compute Engine virtual machine instance in project `analytics-prod`, to read raw dataset files stored in a Cloud Storage bucket located inside a separate project `data-lake-central`. The Compute Engine instance is already configured to run with a custom user-managed service account named `[email protected]`. Following Google Cloud security best practices for cross-project resource access and the principle of least privilege, which configuration should the administrator apply?
- Grant the Storage Object Viewer role (`roles/storage.objectViewer`) on the specific Cloud Storage bucket in `data-lake-central` directly to `[email protected]`.Cevap
- BGenerate a static JSON service account key for a service account created in `data-lake-central`, store the file on the Compute Engine VM, and authenticate using the key file.
- CGrant the primitive Editor role (`roles/editor`) at the project level of `data-lake-central` to `[email protected]`.
- DCreate a new service account in `data-lake-central`, grant it the Storage Admin role, and restrict access on the Compute Engine VM in `analytics-prod` by applying a deny IAM policy at the VM level.
Cevap
Grant the Storage Object Viewer role (roles/storage.objectViewer) on the specific Cloud Storage bucket in data-lake-central directly to [email protected].
Service accounts can be granted IAM roles on resources in different Google Cloud projects. Granting the predefined role `roles/storage.objectViewer` on the specific bucket directly to the custom service account email address fulfills the least privilege requirement safely without key export overhead.
Adım Adım Çözüm
Anahtar Kavram
Cross-Project Service Account Resource Access and Least Privilege