Google Cloud Tutorial · Storage, Databases and Analytics · Lesson 19 of 27
Cloud Storage
Object storage on Google Cloud: buckets, locations, storage classes, lifecycle rules, versioning and access control.
Buckets and objects
Files are objects in buckets. A bucket has a location (a region, a dual-region or a multi-region such as
EU) and a default storage class. Objects are addressed as gs://bucket/path/file.
gcloud storage buckets create gs://acme-invoices --location=europe-west1 \
--uniform-bucket-level-access --public-access-prevention
gcloud storage cp invoice-42.pdf gs://acme-invoices/2026/11/
Storage classes
| Class | Minimum storage | Use for |
|---|---|---|
| Standard | none | frequently read data |
| Nearline | 30 days | read about once a month |
| Coldline | 90 days | read about once a quarter |
| Archive | 365 days | compliance archives, rarely read |
Colder classes cost less to store but more per read, with early-deletion charges. Lifecycle rules change the class or delete objects by age; Autoclass moves objects automatically based on access.
price = {"Standard": 0.020, "Nearline": 0.010, "Coldline": 0.004, "Archive": 0.0012} # illustrative $/GB-month
gb = 10_000
def monthly_cost(age_months):
if age_months < 1:
return gb * price["Standard"]
if age_months < 3:
return gb * price["Nearline"]
if age_months < 12:
return gb * price["Coldline"]
return gb * price["Archive"]
always_standard = sum(gb * price["Standard"] for _ in range(36))
lifecycle = sum(monthly_cost(m) for m in range(36))
print(f"10 TB kept 3 years in Standard: ${always_standard:,.0f}")
print(f"With a lifecycle policy: ${lifecycle:,.0f} ({1 - lifecycle / always_standard:.0%} less)")
Output
10 TB kept 3 years in Standard: $7,200 With a lifecycle policy: $1,048 (85% less)
Protecting data
Use uniform bucket-level access (IAM only, no per-object ACLs), public access prevention, object versioning or soft delete against accidental deletion, and retention policies (with bucket lock) for compliance. Give apps short-lived signed URLs when users need to download or upload one file.
Test yourself
Which setting stops anyone making a bucket's objects public?
Object versioningPublic access preventionNearline storage classAutoclass
Show answer
Answer: Public access prevention
Public access prevention blocks grants to allUsers and allAuthenticatedUsers.