A data engineering team configures an automated script running on a Compute Engine instance to upload daily transaction logs to a Cloud Storage bucket named `fintech-settlements-prod`. To satisfy regulatory compliance, the security team has already enabled Uniform Bucket-Level Access on `fintech-settlements-prod`. During initial testing, the script fails with a HTTP 400 Bad Request error stating that ACLs cannot be set because Uniform Bucket-Level Access is enabled. Inspection of the script reveals it invokes `gcloud storage cp` with the flag `--predefined-acl=bucket-owner-full-control`. How should the team modify the workflow to resolve the upload failure while preserving compliance standards?
- ADisable Uniform Bucket-Level Access on `fintech-settlements-prod` to allow the script to apply fine-grained object ACL flags during the upload operation.
- Remove the `--predefined-acl` flag from the script command and grant the instance service account the predefined `roles/storage.objectCreator` role on the bucket using Cloud IAM.Answer
- CGrant the service account the primitive `roles/owner` role at the project level while keeping the `--predefined-acl` flag in the script.
- DCreate an object-level ACL grant explicitly at the destination prefix in Cloud Storage to override project-level IAM policies.
Answer
Remove the predefined ACL flag from the upload script and grant the service account the predefined Storage Object Creator IAM role on the bucket.
Enabling Uniform Bucket-Level Access (UBLA) on a Google Cloud Storage bucket disables legacy Access Control Lists (ACLs) entirely. Consequently, any operations attempting to set ACLs (such as passing the `--predefined-acl` flag in `gcloud storage cp`) will fail. To resolve this error while preserving compliance, the script must stop specifying ACL flags, and write permissions must be granted exclusively via Cloud IAM using the least-privilege predefined role `roles/storage.objectCreator`.
Step-by-Step Solution
Key Concept
Uniform Bucket-Level Access Enforcement and IAM Role Assignment