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
I assume you already have your domain name and your Google Cloud account. Now simply follow my given step by step tutorial to launch your site on Google Cloud Storage.
- 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.
- Point your Domain to Cloud
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.
- Verify your Domain Ownership
Visit Google Search Console to verify that you are the owner of the domain. Click on 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.
- Create Storage Bucket on GCP
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.
- Configure Storage Bucket and Update Permission
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).
- Upload your website files
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.