Setting up a static website with GCP and Google Domain



This article will cover the setups required to publish a static website on GCP and using a custom domain from Google domain. It assumes we have some content like html page etc. to publish on GCP as static site. Although it is written for domains registered with Google domain, any other domain providers should also work.

Assumptions

We have some static resources like HTML pages to be published.
We have secured a domain name with ownership.
We will be using CNAME to map the domain name to the static page bucket in GCP.

High level steps

1) Setting up the Custom Domain DNS to forward the request to the
2) Setting up the Buckets on Google cloud

Setting DNS on the custom domain 

We want the domain name to be mapped to GCP resource (bucket in our case holding static resources). Setting up the DNS for the custom domain is really simple, we just need to map the CNAME entry in the custom domain DNS section.

Login to Google Domain and go to the DNS setup page for the respective domain. Under the Custom resource records have an entry for www to c.storage.googleapis.com as follows.


Once we save the configuration as above we are good to go to the next section for setting up the static bucket in GCP.

To know more about CNAME and how it works A vs CNAME record explains the advantages of CNAME record and how it works. 

Setting Buckets on Google cloud

Create a bucket whose name matches the CNAME you created for your domain.
For example, if you added a CNAME record pointing www.bootng.com to c.storage.googleapis.com., then create a bucket with the name "www.bootng.com".
To create a bucket:
Open the Cloud Storage browser in the Google Cloud Platform Console.
Click Create bucket to open the bucket creation form.
Enter your bucket information and click Continue to complete each step:
The Name of your bucket.
The Storage class and Location for your bucket.

Click Create.




Once the bucket is created we need to upload the content of the static site and then give appropriate permissions to the individual objects (files directories) or to the bucket itself.

To assign permission to the bucket:

Go to the list of bucket page and corresponding to the bucket just created click on the last column which will open the action menu like bellow and click on Edit bucket permissions link















Since we want to make the content of this bucket publicly available we need to grant read access to a special group called allUsers


Once this is done the bucket list will show that this bucket is available to public access.

Conclusion

With the above setting now when we type www.bootng.com will map to the content of the bucket www.bootng.com on GCP. 

We still need to access resources explicitly for instance if we have welcome.html then we need to type www.bootng.com/welcome.html in the browser

Few things not covered in this article are
1) Mapping default page to the domain name -> so that we can just type www.bootng.com
2) Mapping subdomain to the GCP bucket -> so that we can just type bootng.com











30 comments :

  1. I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information. renewing a domain name

    ReplyDelete
  2. What is an outstanding post! “I’ll be back” (to read more of your content). Thanks for the nudge! tetra packaging

    ReplyDelete
  3. Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign. Epik-protocolEPIK

    ReplyDelete
  4. I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information. combine words

    ReplyDelete
  5. I would recommend my profile is important to me, I invite you to discuss this topic... Best SEO manager

    ReplyDelete
  6. You need to pick the most ideal domain for your site, purchase from a recorder you can trust, and oversee it adequately. Domain Investing

    ReplyDelete
  7. There are a few apparatuses that help to do as such.Website Design Agency

    ReplyDelete
  8. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work... this page

    ReplyDelete
  9. This post is so helfull and informative.keep updating with more information...
    Skills Needed For Data Science
    Career In Data Science

    ReplyDelete
  10. As a newbie to the design development field, I find this blog really helpful, thanks.

    ReplyDelete
  11. GlassWire Elite Activation Key provides you fantastic info and simplifies the system identification that at which the infected document GlassWire 2022 Activation Key

    ReplyDelete
  12. Reimage License Key 2022 updated lists Reimage PC Repair. Reimage License Key Is LifeTime Activate Daily update Keys. Reimage Pc Repair Online License Key Free

    ReplyDelete

Please leave your message queries or suggetions.