Cloud Storage - Object Storage
Cloud Storage is GCP's object storage with 11 nines durability. Objects live in buckets and are accessible globally over HTTPS.
What is Google Cloud Storage?
Cloud Storage is GCP's object storage service - the equivalent of AWS S3. Store any file as an object in a named bucket. Objects are addressed by bucket name + object name (key). No real directory structure; / in object names is just a convention.
Durability: 99.999999999% (11 nines) for Multi-Regional and Dual-Regional buckets.
Storage Classes
| Class | Min Storage Duration | Use For | Access Frequency |
|---|---|---|---|
| Standard | None | Frequently accessed data | Daily/continuous |
| Nearline | 30 days | Backups accessed ~once/month | Monthly |
| Coldline | 90 days | Disaster recovery, quarterly | Quarterly |
| Archive | 365 days | Long-term compliance archives | Yearly or less |
All classes share the same API and have millisecond access time (no restore wait like Glacier). You pay a retrieval fee for Nearline/Coldline/Archive.
Use Object Lifecycle Management to automatically transition or delete objects: age > 30 -> Nearline, age > 90 -> Archive, age > 365 -> delete.
Location Types
- Region: single region (
us-central1). Lowest latency for same-region services. - Dual-Region: two specific paired regions (
NAM4= Iowa + South Carolina). Geo-redundant, turbo replication option (RPO < 15 min). - Multi-Region: broad geographic area (
US,EU,ASIA). Highest availability, highest cost.
Access Control
- IAM (recommended): grant roles at bucket or project level.
roles/storage.objectViewer,roles/storage.objectAdmin. - ACLs (legacy): per-object or per-bucket ACLs. Avoid for new designs.
- Uniform bucket-level access: disables per-object ACLs, enforces IAM-only. Enable this - it simplifies auditing.
- Signed URLs: time-limited pre-signed URL for upload/download. Use to let end users upload directly to GCS without your backend as a proxy.
- Public access: off by default. Enable only for static website hosting or public asset CDN.
Cloud Storage as Static Host
Enable website configuration on a bucket -> serve index.html and 404 page. Pair with Cloud CDN + HTTPS Load Balancer for custom domain and SSL. GCS website endpoint itself only supports HTTP - HTTPS requires the load balancer.
Pub/Sub Notifications
Configure bucket notifications -> Cloud Pub/Sub topic on object create/delete/metadata update. Pattern: upload file -> GCS -> Pub/Sub -> Cloud Function -> process and store result.
Consistency
Cloud Storage offers strong global consistency for all operations - reads after writes always return the new data immediately. This has been true since 2021.
Parallel Composite Uploads
For large files, split into components uploaded in parallel, then compose into a single object. The gsutil tool does this automatically with -o GSUtil:parallel_composite_upload_threshold=150M.
Interview Angle
Cloud Storage questions follow the same pattern as S3: class selection + lifecycle policies for cost, IAM + uniform bucket-level access for security, signed URLs for direct user uploads. GCP differentiators: multi-region buckets for global redundancy, no restore delay even for Archive class (unlike Glacier), and Pub/Sub integration for event-driven pipelines.