Search code examples
amazon-s3google-cloud-storageazure-storage

Equivalent of AWS s3 x-amz-acl header in Azure and Google Cloud


In AWS S3 when uploading an object you can add "x-amz-acl=bucket-owner-full-control" to url (as query parameter) to make the object belong to the bucket and not the uploader. How do you achieve the same when using Cloud Storage or Azure Storage?


Solution

  • For Google Cloud Storage, the equivalent of uploading an object with the x-amz-acl=bucket-owner-full-control is to upload an object with the x-goog-acl=bucket-owner-full-control header. Switching the amz to goog works for most headers. There's a translation table of S3 to GCS headers.

    In addition, if you're looking to make sure that all objects in a bucket are accessible by only the bucket owner, you may find it more convenient to use Uniform Bucket Level Access. Once enabled, individual object ownership within the bucket no longer exists, and you no longer need to specify that header with each upload.

    You can enable Uniform Bucket Level Access from the UI, the API, or via this command: gsutil uniformbucketlevelaccess set on gs://BUCKET_NAME