/Cloud Storage
Concept Detail
Cloud Storage
Difficulty: medium
Overview
Google Cloud Storage (GCS) is Google's unified, scalable object storage service with global availability and strong consistency.
Bucket Location Types:
- Regional: Single region. Best latency for co-located compute. Most cost-effective for regional workloads.
- Dual-region: Two specific regions. Higher availability; automatic geo-redundancy.
- Multi-region (US, EU, ASIA): Highest availability and geo-redundancy. Highest cost.
Storage Classes:
| Class | Intended Access | Min Storage | Retrieval Fee |
|---|---|---|---|
| Standard | Frequent | None | None |
| Nearline | ~1x/month | 30 days | Yes |
| Coldline | ~1x/quarter | 90 days | Higher |
| Archive | ~1x/year | 365 days | Highest |
Key Features:
- Object Versioning: Maintains previous versions of overwritten/deleted objects. Combine with lifecycle rules to retain only N versions or delete versions older than X days.
- Object Lifecycle Management: Define rules to automatically delete objects, change storage class (e.g., Standard → Nearline after 30 days), or remove non-current versions based on age, count, or storage class conditions.
- Signed URLs: Generate time-limited (up to 7 days) URLs granting access to specific objects without requiring a Google account. Generated using a service account's signing key.
- Pub/Sub Notifications: Trigger Pub/Sub messages on object create/delete/metadata-update events — enables event-driven data processing pipelines.
- Uniform Bucket-Level Access: Disables per-object ACLs and enforces IAM-only access on all objects. Recommended for all new buckets for consistent, auditable access control.
Access Control:
- IAM: Storage Admin, Storage Object Viewer, Storage Object Creator — applied at bucket or project level.
- Service Account with Workload Identity: On GCP, bind a Kubernetes service account or GCE service account to a GCS IAM role — no key files required.
- HMAC Keys: S3-compatible access keys for migrating S3-based tooling to GCS without code changes.
Practice Linked Questions
easy
Q1. A GCP application generates log files daily. Files older than 90 days should be deleted automatically to control costs. What is the correct Cloud Storage feature to implement this?
Select one answer before revealing.
hard
Q2. An external script running outside GCP needs to upload files to a specific Cloud Storage bucket for the next 24 hours using the minimum required permissions. What is the recommended approach?
Select one answer before revealing.