Vince Carter
Vince Carter

Reputation: 946

How to create a public bucket in googleapis.com?

I found one public bucket on the web, which contains some files, which everybody can view or download. I want to create the same thing, where I can upload similar files.

Here is how the permissions of this public bucket look like:

public bucket list with public access

Unfortunately I cannot create the same thing, searched the whole web, but haven't found any step by step explanation.

Could anybody help me with this ?

Upvotes: 1

Views: 828

Answers (2)

Brandon Yarbrough
Brandon Yarbrough

Reputation: 38369

From the gsutil command line (which is preinstalled on the cloud shell), you can set this up with these commands:

  1. Make the bucket's contents publicly listable:

gsutil acl ch -g allUsers:R gs://bucketname

  1. Make all objects in the bucket readable by anonymous users:

gsutil acl ch -g allUsers:R gs://bucketname/**

  1. Make all new objects in the bucket publicly readable by default:

gsutil defacl ch -g allUsers:R gs://bucketname

Finally, standard warning about public buckets: anyone is allowed to download resources from this bucket, and the bill will go to the bucket owner, who is you. This could end up being expensive for you if, for instance, you upload a popular video and 10 million people download it. If you want to make an object publicly accessible but want the downloaders to pay for it, you may prefer to use a feature like Requester Pays: https://cloud.google.com/storage/docs/requester-pays

Upvotes: 0

marian.vladoi
marian.vladoi

Reputation: 8056

According to the oficial documentation Making Data Public

  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 contains the object you want to make public, and navigate to the object if it's in a subdirectory.

  3. Click the drop-down menu associated with the object that you want to make public.

    The drop-down menu appears as three vertical dots to the far right of the object's row.

  4. Select Edit permissions from the drop-down menu.

  5. In the overlay that appears, click the + Add item button.

  6. Add a permission for allUsers.

    Select User for the Entity. Enter allUsers for the Name. Select Reader for the Access.

  7. Click Save.

Upvotes: 2

Related Questions