GCP Associate Cloud Engineer Practice Question 43: Custom Role No Delete

Google Cloud Associate Cloud Engineer · Test 5 · question 3 of 10

IAM & Least Privilegemedium

An application must read objects and create new objects in a bucket, but it must never delete or overwrite objects. roles/storage.objectCreator cannot read objects, and roles/storage.objectAdmin also allows deleting them. No other predefined role matches exactly.

What should you do?

Select one answer
Show answer and explanation

Answer:

  • C. Create a custom role with only storage.objects.get and storage.objects.create, and grant it on the bucket

When no predefined role matches the required permissions, a custom role lets you assemble exactly the permissions needed, here storage.objects.get and storage.objects.create (add storage.objects.list if the application lists objects). Granting it on the bucket keeps the scope as narrow as possible.

Option A depends on the application never having a bug or a compromise, which is not a control. Option B is a basic role that grants thousands of permissions across all services. Option D includes Storage Admin, which can delete objects and manage buckets, so the union is broader than the requirement.

Reference: IAM roles and permissions: custom roles

Practice Test 5 ›

Study guides for Google Cloud Associate Cloud Engineer