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


user 9565685

How do I generate signed URLs for objects in my bucket on google cloud storage?

I have a google domain and use google cloud storage to host my objects in a bucket. I don't need to use app engine (to keep costs down). The website will be static. Is there a way to generate signed urls if I don't use app engine?

Brandon Yarborough

Yes, although signed URLs expire quickly and you need to generate new URLs regularly.

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

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

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

Related


Upload to Google Cloud Storage via signed URL - object not public

username I followed this tutorial to allow direct upload of files from the GWT frontend to Google Cloud Storage using signed URLs. I extended the Java example by specifying a content-type that works fine. Then, I found out that files uploaded this way are not

Upload to Google Cloud Storage via signed URL - object not public

username I followed this tutorial to allow direct upload of files from the GWT frontend to Google Cloud Storage using signed URLs. I extended the Java example by specifying a content-type that works fine. Then, I found out that files uploaded this way are not

Upload to Google Cloud Storage via signed URL - object not public

username I followed this tutorial to allow direct upload of files from the GWT frontend to Google Cloud Storage using signed URLs. I extended the Java example by specifying a content-type that works fine. Then I see that files uploaded this way are not publicl

Upload to Google Cloud Storage via signed URL - object not public

username I followed this tutorial to allow direct upload of files from the GWT frontend to Google Cloud Storage using signed URLs. I extended the Java example by specifying a content-type that works fine. Then I see that files uploaded this way are not publicl

Enable CORS for my project object on Google Storage Signed URL

Piluc I have CORS enabled in my bucket in Google Cloud Storage; now I add a wildcard (*) for any origin and method, but I still get "The origin ' https://my-app.net ' is therefore not allowed" . In recovery, all objects in the bucket are not public, but my ser

Enable CORS for my project object on Google Storage Signed URL

Piluc I have CORS enabled in my bucket in Google Cloud Storage; now I add a wildcard (*) for any origin and method, but I still get "The origin ' https://my-app.net ' is therefore not allowed" . In recovery, all objects in the bucket are not public, but my ser

Enable CORS for my project object on Google Storage Signed URL

Piluc I have CORS enabled in my bucket in Google Cloud Storage; now I add a wildcard (*) for any origin and method, but I still get "The origin ' https://my-app.net ' is therefore not allowed" . In recovery, all objects in the bucket are not public, but my ser

Google Cloud Storage sees wrong content type on my static files

Michael Miller My Google Cloud Storage browser is seeing the wrong content type on all my static files (css, js, jpg, etc.) which is causing a mime type error when serving these files which is causing my site to not apply my CSS styles. Why is this happening a

Google Cloud Storage sees wrong content type on my static files

Michael Miller My Google Cloud Storage browser is seeing the wrong content type on all my static files (css, js, jpg, etc) which is causing a mime type error when serving these files which is causing my site to not apply my CSS styles. Why is this happening an

Google Cloud Storage sees wrong content type on my static files

Michael Miller My Google Cloud Storage browser is seeing the wrong content type on all my static files (css, js, jpg, etc) which is causing a mime type error when serving these files which is causing my site to not apply my CSS styles. Why is this happening an

Google Cloud Storage sees wrong content type on my static files

Michael Miller My Google Cloud Storage browser is seeing the wrong content type on all my static files (css, js, jpg, etc) which is causing a mime type error when serving these files which is causing my site to not apply my CSS styles. Why is this happening an

How to shorten google cloud storage signed download url?

Brandon I have an firebaseapp where I use to Firebase Storageupload pictures. URLWhen I use firebase web sdkupload , si returns reasonable : https://firebasestorage.googleapis.com/v0/b/projectId.appspot.com/o/image.jpg?alt=media&token=51183d4a-551a-41e2-b620-1

How to shorten google cloud storage signed download url?

Brandon I have an firebaseapp where I use to Firebase Storageupload pictures. URLWhen I use firebase web sdkupload , si returns reasonable : https://firebasestorage.googleapis.com/v0/b/projectId.appspot.com/o/image.jpg?alt=media&token=51183d4a-551a-41e2-b620-1

How to shorten google cloud storage signed download url?

Brandon I have an firebaseapp where I use to Firebase Storageupload pictures. URLWhen I use firebase web sdkupload , si returns reasonable : https://firebasestorage.googleapis.com/v0/b/projectId.appspot.com/o/image.jpg?alt=media&token=51183d4a-551a-41e2-b620-1