How to set up Google Cloud Storage

I’m trying to upload files to a bucket in Google Cloud Storage, but it’s hard for me to figure out how to set it up so that it is public and readable. In other words, I do not want to require authentication from the user to load into the bucket. Does anyone know what steps should be taken to configure this?

I would also like to know what I need to add to my request headers in order to upload files to this bucket. I am using the iOS API client, but if someone knows what the source headers are, I can probably figure out how to do this in iOS. At the moment, I only include the following additional header: x-goog-project-id

+7
google-cloud-storage google-api google-cloud-platform google-api-client
source share
2 answers

For your first question, you can publish your new uploaded objects using the following command, which uses the gsutil acl syntax :

 gsutil defacl ch -u allUsers:R gs://<bucket> 

Now you need to grant write access to this bucket to everyone using the command:

 gsutil acl ch -u allUsers:O gs://<bucket> 

As for your other question, I am not familiar with iOS, but you can go to the bottom of this page and load the object, and you 'Look at the HTTP request that you can use in your code.

In addition, there is a Google API Client Library for Objetive-C , and it seems that with this library you can manage Google cloud storage in accordance with these files .

Hope this helps.

+10
source share

Please consider using signed URLs ( https://developers.google.com/storage/docs/accesscontrol#Signed-URLs ) instead of making your bucket public. Having a publicly recorded bucket can be a revelation for various forms of abuse, and it can also lead to a surprisingly high score if someone buys your bucket from the Internet, which then loads large amounts of data into it.

+2
source share

All Articles