user9565685
user9565685

Reputation:

How can I generate a signed url for an object in my google cloud storage for static html content

How can I generate a signed URL for objects in my bucket on google cloud storage?

I have a google domain and using google cloud storage to host my objects in buckets. I do not need the use of an app engine (to reduce cost). The site will be static. Is there a way to generate a signed url if I am not using an app engine?

Upvotes: 0

Views: 4716

Answers (1)

Brandon Yarbrough
Brandon Yarbrough

Reputation: 38389

Yes, although signed URLs expire fairly quickly, and you'll need to periodically generate new ones.

Most of the client libraries support signing URLs programatically, but if you have gsutil, the easiest way to generate one is to create a service account and download its keyfile (let's say my-account.json), then run:

gsutil signurl -d 1d my-account.json gs://mybucket/myobject

The "1d" means 'valid for one day.' More docs here: https://cloud.google.com/storage/docs/gsutil/commands/signurl

Upvotes: 2

Related Questions