Skip to content
Visual explainer 3h to learn 5 steps

Cloud Storage buckets, classes, lifecycle and signed URLs

Create a bucket with the right location and class, add lifecycle and soft-delete protection, and share one object with a signed URL.

By Invicly Tech, , in Google Cloud Engineering and Services. About 9 minutes to read.

Topic 13 of 32

In short

Cloud Storage keeps objects (files plus metadata) in buckets. You choose where a bucket lives and which storage class its objects start in, then add rules that move or delete objects over time. Soft delete, versioning and signed URLs cover recovery and sharing.

Think of it like this: A bucket is a warehouse with one street address: you pick the city, the shelf price depends on how often you fetch boxes, and a signed URL is a one-day visitor pass for a single box.

Explained simply

Cloud Storage is where you keep files on Google Cloud. A file is called an object, and objects live in buckets. A bucket name is unique across all of Google Cloud, so names like example-orders-PROJECT_ID work better than orders.

When you make a bucket you choose its location. A region is one place, such as europe-west2. A dual-region is two places that back each other up. A multi-region spreads data across a large area. You cannot change this later, so think about where your users and your rules about data are.

You also choose a storage class. All classes read data quickly. What changes is the price: Standard costs more to store but nothing to read, while Nearline, Coldline and Archive cost less to store but charge when you read, and have a minimum time you pay for.

Finally you protect and share. Soft delete keeps deleted files for a while. Versioning keeps old copies when you overwrite. A signed URL is a link that works for a short time, so you can share one file without making the bucket public.

Press Play on a diagram to walk through it one step at a time.

CompareStorage classes: price against access
Standard
  • No minimum storage time
  • Highest storage price, no retrieval fee
  • Hot data: websites, active files
Nearline and Coldline
  • Minimum 30 and 90 days
  • Cheaper storage, retrieval fee
  • Backups read about monthly or quarterly
Archive
  • Minimum 365 days
  • Lowest storage price
  • Retrieval fee applies
  • Still returns data in milliseconds
FlowA lifecycle for order exports
  1. Step 1
    Day 0

    Object created in Standard

  2. Step 2
    Day 30

    Rule moves it to Nearline

  3. Step 3
    Day 365

    Rule moves it to Archive

  4. Step 4
    Day 2555

    Rule deletes it

SequenceSigned URL: who talks to whom
Your API
Customer browser
Cloud Storage
  1. 1Ask to download report.pdf
    Customer browser to Your API: Ask to download report.pdf
  2. 2Sign URL with service account, 10 minutes
    Your API to Your API: Sign URL with service account, 10 minutes
  3. 3Return the signed link
    Your API to Customer browser: Return the signed link
  4. 4GET the link
    Customer browser to Cloud Storage: GET the link
  5. 5File returned if signature and expiry are valid
    Cloud Storage to Customer browser: File returned if signature and expiry are valid

In depth

Location type and why it is permanent

A bucket's location is fixed at creation. To move data you create a new bucket and copy objects across. A region keeps data in one place at the lowest cost and with the lowest latency for nearby compute. A dual-region stores data in two chosen regions, which helps when a whole region is unavailable. A multi-region suits content read from many continents.

Residency rules matter too. If a contract says data must stay in the UK, a multi-region may break it.

  • Region: cheapest, lowest latency to nearby compute
  • Dual-region: two regions, higher resilience
  • Multi-region: wide area, good for global reads
  • Put the bucket near the code that uses it

Lifecycle rules and Autoclass

A lifecycle rule has a condition and an action. Conditions include age in days, the current storage class, how many newer versions exist, and name prefixes. Actions include Delete and SetStorageClass. The rules run in the background, so changes are not instant.

If you cannot predict access, Autoclass can move objects between classes for you based on use. Check the current pricing page before relying on it, because it adds a management fee.

Always keep a rule that deletes old noncurrent versions when versioning is on.

MapLifecycle rule building blocks
Lifecycle rule
  • Conditions
    • age
    • matchesStorageClass
    • numNewerVersions
    • matchesPrefix
  • Actions
    • Delete
    • SetStorageClass
    • AbortIncompleteMultipartUpload

Soft delete, versioning and access control

Soft delete is a bucket setting with a retention period. Deleted objects stay recoverable until it ends. Versioning keeps older generations of an object when you overwrite or delete it. They overlap but solve different mistakes: soft delete covers deletion, versioning covers overwrites.

Turn on uniform bucket-level access so access is decided only by IAM roles on the bucket or project. Give applications roles such as Storage Object Viewer on one bucket rather than broad roles on the whole project. This is least privilege applied to storage.

Learn it in 5 short steps

About 35m each. Track them with a timer in your plan.

  1. 1
    Pick bucket location type~35m
  2. 2
    Choose a storage class~35m
  3. 3
    Write lifecycle rules~35m
  4. 4
    Use soft delete and versioning~35m
  5. 5
    Issue a signed URL with uniform access~35m

Key points

  • Location type is chosen once: a region, a dual-region or a multi-region. It cannot be changed later, so decide from latency, resilience and data rules.
  • A storage class sets price and minimum storage time. Every class has the same millisecond access; the difference is cost, not speed.
  • Lifecycle rules act on age, class, version count and similar conditions. They run on their own, so test them on a spare bucket first.
  • Soft delete (7 days by default) and versioning protect against mistakes. Use uniform bucket-level access so only IAM decides who can read.
  • A signed URL lets someone without a Google account fetch one object until it expires. A V4 signed URL lasts at most 7 days.

Key terms

Tap a card to flip it. 0/6 known

Examples

bash
gcloud storage buckets create gs://example-orders-<project-id> \
  --location=europe-west2 \
  --default-storage-class=STANDARD \
  --uniform-bucket-level-access

gcloud storage buckets update gs://example-orders-<project-id> --versioning

gcloud storage sign-url gs://example-orders-<project-id>/report.pdf \
  --duration=10m \
  --impersonate-service-account=signer@<project-id>.iam.gserviceaccount.com

Placeholder names. Create a bucket, then print a 10 minute link for one object.

Lifecycle for monthly exports

Order exports are read often for a month, rarely for a year, and must be kept seven years. Save this as lifecycle.json, then apply it. Check the result on a test bucket first: the rules act on every matching object.

bash
cat > lifecycle.json <<'EOF'
{"rule": [
 {"action": {"type": "SetStorageClass", "storageClass": "NEARLINE"},
  "condition": {"age": 30}},
 {"action": {"type": "SetStorageClass", "storageClass": "ARCHIVE"},
  "condition": {"age": 365}},
 {"action": {"type": "Delete"}, "condition": {"age": 2555}}
]}
EOF
gcloud storage buckets update gs://example-orders-PROJECT_ID \
  --lifecycle-file=lifecycle.json

Protect against a bad deploy

A script overwrote exports with empty files. With versioning on, older generations still exist. Prerequisite: versioning was enabled before the mistake. List the versions, then copy the good one back. Cleanup: delete the bad generation, or let a lifecycle rule remove it.

bash
gcloud storage buckets update gs://example-orders-PROJECT_ID --versioning
gcloud storage ls --all-versions gs://example-orders-PROJECT_ID/2026-11.csv
# copy the good generation back to the live name
gcloud storage cp \
  gs://example-orders-PROJECT_ID/2026-11.csv#GENERATION \
  gs://example-orders-PROJECT_ID/2026-11.csv

Quick reference

  • Location type is permanent: region, dual-region or multi-region.
  • Minimum storage time: Nearline 30 days, Coldline 90, Archive 365.
  • All classes have millisecond access; the cost model differs.
  • Soft delete retention defaults to 7 days.
  • Signed URL (V4) lifetime is at most 7 days.
  • Use uniform bucket-level access so IAM alone decides access.
  • Lifecycle actions: Delete, SetStorageClass, AbortIncompleteMultipartUpload.

Common mistakes

  • Making a bucket public to share one file. Use a signed URL or an IAM binding instead.
  • Putting short-lived data in Nearline or Coldline and paying for the minimum storage time anyway.
  • Turning on versioning without a lifecycle rule for old versions, so storage grows forever.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Which setting cannot be changed after a bucket is created?

Question 2

2Data is read once a quarter and kept for years. Which class fits best?

Question 3

3A user without a Google account needs one file for an hour. What is safest?

Question 4

4Versioning is on and storage keeps growing. What should you add?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Create a regional bucket with uniform bucket-level access and versioning on, using placeholder names.

  2. Exercise 2medium

    Write a lifecycle rule that deletes objects under the prefix tmp/ after 7 days. Describe how you would test it safely.

  3. Exercise 3hard

    Design access for a web app that serves private invoices: who can read, who can sign, and how links expire.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Is Archive class slow to read?
No. Reads take milliseconds like other classes. Archive costs less to store but more to retrieve, with a 365 day minimum.
What is the difference between soft delete and versioning?
Soft delete keeps deleted objects for a period. Versioning keeps older copies when an object is overwritten or deleted.
Can I test Cloud Storage without a project?
Partly. Community emulators such as fake-gcs-server model basic calls, but they do not copy IAM, lifecycle timing or signed URL checks exactly.

Go deeper

ShareXLinkedInWhatsApp