0

I have a bucket of images on Google Cloud storage. I've set the bucket's access control to uniform and made the bucket public. I'd now like to set the Cache-Control metadata for the bucket to have a max-age of one year, rather than the default one hour.

However, I cannot set the metadata for individual objects, since this is a uniform bucket. I simply get

AccessDeniedException: 403 <my email> does not have storage.objects.update access to the Google Cloud Storage object.

Which is expected.

I cannot find an option in the GUI or a command for the cloud shell to set metadata on a uniform bucket, does any one know how, or do I need to switch back to Fine-grained access control?

Chris Hamilton
  • 9,252
  • 1
  • 9
  • 26

1 Answers1

3

The error you have is not related to setting object/s metadata! it means the identity (google account or the service-account) that you are using does not have permission to update objects in buckets.

You need to review the IAM permissions given to your identity and add all required IAM permissions.


You can edit the Cache-Control in object/s metadata from Cloud Console as follows:

  1. In the Google Cloud Console, go to the Cloud Storage Browser page.

  2. In the list of buckets, click on the name of the bucket that contains the desired object.

  3. The Bucket details page opens, with the Objects tab selected.

  4. Navigate to the object, which may be located in a folder.

  5. Certain object metadata values, such as the object's size and storage class, are displayed along with the object's name.

  6. Click the more actions menu () associated with the object.

  7. Click Edit metadata.

    The overlay window that appears shows the current values for the object's editable metadata.


Reference: documentation.

Note:

The Cloud Console does not provide an exhaustive list of metadata associated with objects. To view all of an object's metadata, follow the gsutil instructions.

Atef Hares
  • 4,715
  • 3
  • 29
  • 61
  • This worked, thanks! I assumed uniform access control meant that ALL object settings were uniform, but I guess that only applies to public / private access, not metadata. – Chris Hamilton Feb 25 '22 at 22:23
  • @ChrisHamilton You're welcome. `uniform` or `fine-grained` is not related to objects meta data. these are the two available types of GCS bucket access. either control access for the whole bucket (uniform) or control access per object (fine-grained). – Atef Hares Feb 25 '22 at 22:58