Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you make many files public in Google Cloud Storage?

I have 1000 files in Google Cloud Storage to make public, or in general a directory hierarchy.

In the Web UI, I can only seem to make one at a time public.

Is there some way to do this.

like image 698
engineerchuan Avatar asked Jan 17 '13 02:01

engineerchuan


People also ask

Is there a limit to Google Cloud storage?

Every Google Account comes with 15 GB of storage that's shared across Google Drive, Gmail, and Google Photos. When you upgrade to Google One, your total storage increases to 100 GB or more depending on what plan you choose.

How do I access public Google storage bucket?

Note: Accessing public data via the Google Cloud console requires you to sign in with a Google account. The method described in the API link tab provides the most broadly applicable way to access individual public objects. Get the name of the public object and the bucket that stores the object.


Video Answer


2 Answers

Run gsutil -m acl set -R -a public-read gs://bucket

  • The -m issues multiple requests at the same time.
  • The -R issues requests for every object in your bucket.
  • The -a issues requests for every version of every object.

See gsutil help acl for more info.

At the API layer gsutil issues the following HTTP request:

PUT /bucket/obj?acl HTTP/1.1
Host: storage.googleapis.com
x-goog-acl: public-read

You can see this by using the -D flag with gsutil:

gsutil -D setacl public-read gs://bucket/obj
like image 94
fejta Avatar answered Nov 01 '22 00:11

fejta


You can make all objects in a bucket public. Here's the link.

  1. Open the Cloud Storage browser in the Google Cloud Platform Console.
  2. In the list of buckets, click on the name of the bucket that you want to make public.
  3. Select the Permissions tab near the top of the page.
  4. Click the Add members button.
    The Add members dialog box appears.
  5. In the Members field, enter allUsers.
  6. In the Roles drop down, select the Storage sub-menu, and click the Storage Object Viewer option.
  7. Click Add.

Once shared publicly, a link icon appears for each object in the public access >column. You can click on this icon to get the URL for the object.

like image 24
Erik Avatar answered Oct 31 '22 22:10

Erik