bucket-website-app

command module
v0.0.0-...-0b252ea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

README

Host a static website using Cloud Run and Cloud Storage

index.html is the index page, served when a request URL ends in /.

Run Button

Create a service account that has Storage Object Viewer access. (This can be done in the Web Console UI as well.)

export PROJECT_ID=...

# Create service account
gcloud iam service-accounts create cloud-run-app

# Add Storage Object Viewer access to the service account role.
gcloud projects add-iam-policy-binding $PROJECT_ID --member "serviceAccount:cloud-run-app@$PROJECT_ID.iam.gserviceaccount.com" --role "roles/storage.objectViewer"

Now hit the run button. It will ask for two env vars:

Run on Google Cloud

  • BUCKET: name of the GCS bucket
  • SERVICE_ACCOUNT: name of a service account that has Storage Object Viewer access. If you created one using the steps above, use cloud-run-app@$PROJECT_ID.iam.gserviceaccount.com.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL