Hosting a Static website on Google Cloud Storage is very easy. If you are planning to launch a simple static website with just only HTML, CSS, JavaScript and Images, then you donâÃÂÃÂt need a web server for that. You can upload your website files into Google Cloud Storage and your site will be live in a few minutes
In this tutorial, IâÃÂÃÂm going to show you âÃÂàHow to launch a Static Website on Google Cloud Storage for FREE!
Ok, Now LetâÃÂÃÂs Get started!
Steps to Host a Static Website on Google Cloud Storage for FREE
Log in to your google cloud account Visit cloud.google.com and then just login to your Google Cloud account. Once you sign in to your GCP account, then you can see your Google Cloud Dashboard like the following screenshot. To point your domain to Cloud Storage, you need to create a CNAME record pointing yourdomainname.com to c.storage.googleapis.com
To do this, visit your DomainâÃÂÃÂs DNS settings section and click on the Add record and select CNAME
Now in the Name section enter www and in the Points section enter c.storage.googleapis.com and then save the record. Add Property option to connect your new domain and then you can see many options are available for domain verification like HTML Metadata, Google Analytics, etc. The easiest one is DNS verification through a TXT record. So finish your ownership verification using any method you like and then proceed to the next step. Visit Google Search Console to verify that you are the owner of the domain. Click onoption to connect your new domain and then you can see many options are available for domain verification like HTML Metadata, Google Analytics, etc. The easiest one is DNS verification through a TXT record. So finish your ownership verification using any method you like and then proceed to the next step. Visit your cloud console dashboard area and then from the navigation menu bar, click on the âÃÂÃÂStorageâÃÂàlink
Now you need to create a bucket and after that enter the âÃÂÃÂbucket nameâÃÂà(note: if you would like to point your domain name to storage then you got to give the bucket name as a domain name)
Next, you need to select the âÃÂÃÂstorage classâÃÂà(leave multi-regional for high-performance & availability)
Now select a location from the US, EU & Asia (choose the nearest to your audience) and then click on âÃÂÃÂCreate.âÃÂÃÂ
Once bucket creation is done successfully, you can see them on your list. Select your bucket from the list and then click on edit bucket permission. It will open permissions properties
Now in this permission property section, you need to type âÃÂÃÂallUsersâÃÂàin the âÃÂÃÂAdd membersâÃÂàfield and select permission as âÃÂÃÂStorage Object Viewer. After that click to the Add, button to save the configuration
Next, click on setting icon again >>Edit website configuration and then fill details on Main page & 404 (not found) page section (most of the case their value would be index.html & 404.html respectively). Once you did finish the previous configuration, you can proceed to the website file upload process
Open your newly created bucket section and then click âÃÂÃÂUpload folder/Upload filesâÃÂàand choose your website files to upload. Make sure index.html is present in bucket root
Please note âÃÂàBased on your file size, uploading may take some time
YouâÃÂÃÂre done! It may take some time to get DNS propagated globally, and you may use the DNS lookup tool to verify the results
So, after sometime later, try to access your site by entering your site URL on the browser, and you will see your static website is live for the public
Suggested Reading âÃÂàHow to set up a domain on a Google Cloud server
I hope this guide helps you to launch your static website on Google Cloud Storage. If you find this guide helpful, then please donâÃÂÃÂt forget to share it with your friends and family!
If you have any questions/queries or suggestion then feel free to let me know by commenting below.