Static Website Hosting on GCP
Serverless static website hosting using Google Cloud Storage
Overview
A deployment demonstrating how to host a static website on Google Cloud Storage with proper IAM configuration, public access controls, and custom domain mapping — a cost-effective, serverless alternative to traditional hosting.
Problem Statement
Hosting static websites traditionally requires provisioning and managing web servers, incurring overhead for infrastructure that simply needs to serve files. A simpler, more cost-effective, and maintenance-free solution is needed for static content delivery.
Key Features
- Static website hosting directly from a Cloud Storage bucket
- IAM-controlled public access with allUsers read permissions
- Custom index page and 404 error page configuration
- Cost-efficient serverless hosting with no compute required
- Scalable to any traffic level without infrastructure changes
Architecture
Challenges & Solutions
Correctly configuring IAM permissions to make the bucket publicly readable without exposing bucket metadata or write access.
Applied the `roles/storage.objectViewer` IAM binding to `allUsers` at the bucket level, which grants read-only access to objects without any administrative permissions.
What I Learned
- Cloud Storage bucket configuration for static website hosting
- IAM policy design for controlled public access to GCP resources
- The trade-offs between Cloud Storage hosting and compute-based hosting for static content