How do I setup a public Google Cloud Storage bucket

后端 未结 2 1163
清酒与你
清酒与你 2021-02-19 08:36

I am trying to upload files to a bucket on Google Cloud Storage, but I am having trouble figuring out how to set it up so that it is publicly writable and readable. In other wor

相关标签:
2条回答
  • 2021-02-19 09:04

    Please consider using signed URLs (https://developers.google.com/storage/docs/accesscontrol#Signed-URLs ) instead of making your bucket publicly writable. Having a publicly writable bucket can be an opening to various forms of abuse, and also could result in your getting a surprisingly high bill if your bucket is discovered by someone on the Internet who then uploads large amounts of data to it.

    0 讨论(0)
  • 2021-02-19 09:08

    For your first question, you can make your public your new uploaded objects with the following command that uses the gsutil acl syntax:

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

    Now you need to give access to write to that bucket to everybody using the command:

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

    Regarding your other question, I'm not familiar with iOS but you can go to the bottom of this page and upload an object and you'll see the HTTP request that you can use in your code.

    Also, there is Google API Client Library for Objetive-C and it seems that with that library you can manage Google Cloud Storage as per these files.

    I hope it helps.

    0 讨论(0)
提交回复
热议问题