A cloud engineer needs to grant a service account read access to files stored in a Cloud Storage bucket named `customer-analytics-data`. Uniform Bucket-Level Access is currently enabled on the bucket. When an automated script attempts to apply fine-grained object Access Control Lists (ACLs) to grant read permission, the operation fails. Which action should the engineer take to properly grant the service account read access while adhering to Google Cloud security best practices?
- Grant the predefined Cloud Storage IAM role `roles/storage.objectViewer` to the service account at the bucket level.Answer
- BUse `gcloud storage objects update` with a canned ACL of `projectPrivate` to override the Uniform Bucket-Level Access restriction on individual objects.
- CGrant the primitive `roles/viewer` role to the service account at the GCP project level so it inherits read permissions for all bucket objects.
- DDisable IAM policy inheritance on the bucket so object ACLs can override project-level access controls.
Answer
Grant the predefined Cloud Storage IAM role `roles/storage.objectViewer` to the service account at the bucket level.
When Uniform Bucket-Level Access is enabled on a Cloud Storage bucket, access control lists (ACLs) are disabled, and Cloud IAM becomes the sole access control mechanism. The standard Google Cloud security recommendation is to grant predefined IAM roles (such as Storage Object Viewer) at the bucket level to provide necessary access following the principle of least privilege.
Step-by-Step Solution
Key Concept
Uniform Bucket-Level Access & Cloud IAM Best Practices