CDN setup for a static website
We hosted a static website on Google Storage in the previous chapter. In this recipe, we'll set up a Cloud CDN for another simple static site. Google Cloud CDN caches the contents of our static website in the globally distributed edge POPs. This helps bring the content faster to the end user and a reduction of the cost to serve from the data center.
We'll create a simple index.html
and host it in our storage bucket. By putting this bucket behind a load balancer, we'll get an IP to hit our index.html
file directly . As a second step, we'll set up a CDN and measure the increase in performance and explore the cache invalidation feature.
Getting ready
The following are the initial setup verification steps and static site creation to be carried out before the recipe can be executed:
- Create or select a GCP project.
- Enable billing and enable the default APIs (some APIs such as BigQuery, storage, monitoring, and a few others are enabled automatically).
- Create a bucket...