site logo
search logo


Your Details

Contact Us


Static Website Hosting on Google Cloud Storage

This tutorial describes how to configure a Cloud Storage bucket to host a static website for a domain you own. Static web pages can contain client-side technologies such as HTML, CSS, and JavaScript. For more information see the Static Website page.

Static Website Hosting on Google Cloud Storage
  • How to Host Static Website on Google Cloud Storage

    1. Goto Google Cloud Storage console

    2. Create a multiregional bucket with the domain name ex: (Assuming that the domain is already registered)

    3. Change permissions at bucket level (public read to all users) by executing the following commands:

    a. gsutil acl ch -u AllUsers:R gs://

    b. gsutil defacl set public-read gs://

    4. Upload website files and folders to Google Cloud Storage bucket (created in step 2).

    5. Make sure that all the files in the bucket are shared publicly.

    6. Now click on the domain name in the browser to open website hosted in it.



  B. How to create SSL certificate for the hosted website on Cloud Storage


  • This can be done using Google Cloud Load Balance
  • Create load balancer from Google Cloud Console by following below steps:

    a. Click Create Load Balancer button

    b. Goto HTTPS Load Balancer configuration

    c. Click Backend Configuration - goto Backend buckets - select the bucket that is created and save it.

    d. Goto Frontend configuration - select protocol as HTTPS, and leave ip as ephemeral (in a production environment it is recommended to have a static ip) and save it.

    e. Drop down certificate and click new certificate. A popup will open where you have to enter public key - received in the mail once you fill the ssl certification form, enter private key and csr certificate after you create the private key using the below command.




    i. Type this in the gcloud shell -

openssl req -out techpostal.csr -newkey rsa:2048 -nodes -keyout


where, techpostal can be any key name that you want to save with.

ii. You will notice the private key & CSR file created.

iii. root@web-server:~# ls -ltr

     -rw-r--r-- 1 root root 1704 Sep  2 06:56 techpostal.key

     -rw-r--r-- 1 root root 1017 Sep  2 06:56 techpostal.csr

iV. Open the files using cat techpostal.key and cat techpostal.csr, copy and paste it as mentioned in the above step(step e).

V. Click save to save the load balancer.

Vi. You got to update your domain A record to point the load balancer IP (ephemeral ip generated) at the domain registrar.


Get our hottest stories delivered to your inbox.

Sign up for Scrabbl Newsletters to get personalized updates on top stories and viral hits.