Prev Next

Cloud / Google Cloud Storage Interview questions

Last updated

1. What is Google Cloud Storage? 2. What are buckets and objects in Cloud Storage? 3. What are the storage classes in Google Cloud Storage? 4. What are the location types for a Cloud Storage bucket? 5. What are the rules for naming a Cloud Storage bucket? 6. What is object versioning in Cloud Storage? 7. What is Object Lifecycle Management in Cloud Storage? 8. What is a signed URL in Cloud Storage? 9. How do you create a bucket using the gcloud CLI? 10. How do you upload and download objects using gcloud storage? 11. What is uniform bucket-level access? 12. What is the durability and availability of Cloud Storage? 13. What is the maximum size of an object in Cloud Storage? 14. What is Autoclass in Cloud Storage? 15. What is a retention policy in Cloud Storage? 16. What is soft delete in Cloud Storage? 17. What are the IAM roles commonly used with Cloud Storage? 18. What is Cloud Storage FUSE? 19. What is the Storage Transfer Service? 20. What is the purpose of Pub/Sub notifications for Cloud Storage? 21. What is the difference between Nearline, Coldline, and Archive? 22. What is the difference between IAM and ACLs in Cloud Storage? 23. When would you choose a dual-region bucket with turbo replication? 24. How does Cloud Storage provide strong consistency? 25. How do resumable uploads work in Cloud Storage? 26. Why do we use parallel composite uploads? 27. What happens when you overwrite an object in a versioned bucket? 28. How do you secure a Cloud Storage bucket against public exposure? 29. What is the difference between CMEK and CSEK in Cloud Storage? 30. What is the difference between signed URLs and signed policy documents? 31. What is the difference between a retention policy and an object hold? 32. How does Bucket Lock enforce immutability? 33. When should you use Storage Transfer Service versus Transfer Appliance? 34. How can you optimize Cloud Storage costs? 35. How do you troubleshoot a 403 Forbidden error on Cloud Storage? 36. How do you troubleshoot HTTP 429 errors on Cloud Storage? 37. Explain the lifecycle of an object across storage classes? 38. Explain the execution flow of a signed URL request? 39. Why is a bucket's location permanent, and how do you migrate one? 40. What is the difference between gsutil and gcloud storage? 41. How do you host a static website on Cloud Storage? 42. When should you enable requester pays on a bucket? 43. How does CORS work in Cloud Storage? 44. What is the difference between Cloud Storage, Persistent Disk, and Filestore? 45. Why do we use hierarchical namespace buckets in Cloud Storage? 46. What is the difference between soft delete and object versioning? 47. How can you optimize object naming for high request rates? 48. How do you audit access to Cloud Storage objects? 49. How does Anywhere Cache improve read performance? 50. How do you restrict Cloud Storage access using VPC Service Controls?

1. What is Google Cloud Storage?

Google Cloud Storage (GCS) is Google Cloud's managed object storage service. You keep unstructured data such as images, backups, logs and analytics files as objects inside buckets, and reach them over HTTP through the JSON and XML APIs, client libraries, the gcloud storage CLI or the console.

There is no disk or server to provision. Capacity is effectively unlimited, and every storage class is designed for 11 nines of annual durability. Billing is based on data stored, operations performed and network egress.

Typical uses are data lakes, media delivery, backups and archives, static websites and machine learning datasets.

Take quiz
Which kind of storage is Google Cloud Storage?
An in-memory cache
A managed relational database
Object storage
Block storage attached to a single VM
Where does Cloud Storage keep your data?
As rows inside tables
As messages inside topics
As files on a persistent disk you size yourself
As objects inside buckets

2. What are buckets and objects in Cloud Storage?

A bucket is the top-level container. Its name is globally unique, and it carries settings such as location, default storage class, versioning and access control. An object is the actual data plus its metadata, and it always lives in exactly one bucket.

The namespace is flat. A name like logs/2026/app.log is just one long object name; the console shows folders only because of the slash convention.

Aspect Bucket Object
Purpose Container and policy boundary Data plus metadata
Name scope Unique across all of Cloud Storage Unique within its bucket
Changes Settings can be updated Immutable; a change writes a new generation

Each object is identified by its name and a generation number.

Take quiz
What does a name like logs/2026/app.log really represent?
One flat object name; the folder look is only a convention
A compressed archive
Three separate buckets
A real nested directory tree
Which statement about objects is correct?
They can only be changed from the console
They are immutable, so a change writes a new generation
They share one name across all buckets
You can edit bytes in the middle in place

3. What are the storage classes in Google Cloud Storage?

Cloud Storage has four classes: Standard, Nearline, Coldline and Archive. They share the same API, millisecond access and durability. What changes is price: colder classes cost less to store but add retrieval fees and a minimum storage duration.

Class Min. duration Typical use
Standard None Hot data, websites, active analytics
Nearline 30 days Read about once a month, backups
Coldline 90 days Read about once a quarter, DR copies
Archive 365 days Compliance and long-term retention

Deleting or moving an object before the minimum duration still bills you for the remaining days.

Take quiz
Which storage class has a 365-day minimum storage duration?
Standard
Coldline
Archive
Nearline
How is Archive different from tape-style archives?
It uses a different API than Standard
Objects must be thawed before every read
Restores take hours and need a ticket
Data is still available in milliseconds, but retrieval costs more

4. What are the location types for a Cloud Storage bucket?

A bucket is created in one of three location types, and it cannot be changed afterwards.

Type Example Where data lives
Region us-central1 Redundant across zones in one region
Dual-region nam4, eur4 Two specific regions, with optional turbo replication
Multi-region US, EU, ASIA Spread across a large geographic area

Pick a region to keep data close to compute and costs low. Choose dual-region or multi-region when you need higher availability and geo-redundancy for serving or disaster recovery.

Location also affects price, latency and available features. For example, turbo replication exists only for dual-region buckets, and some compliance rules require data to stay in a named region or area.

Take quiz
Which location type stores data in two specific regions?
Dual-region
Single region
Zonal
Multi-region
You created a bucket in us-central1 and now want it in Europe. What is true?
Run buckets update --location=eu
A bucket's location is fixed; you must create a new bucket and copy data
Google moves it automatically after 30 days
Change the location field in bucket settings

5. What are the rules for naming a Cloud Storage bucket?

Bucket names must be globally unique and follow these rules:

  • 3 to 63 characters (up to 222 if the name contains dots, each part at most 63).
  • Only lowercase letters, numbers, dashes, underscores and dots.
  • Must start and end with a letter or number.
  • Cannot look like an IP address, start with goog, or contain google or close misspellings.

Names that contain dots usually represent domains and require domain ownership verification. Because names are public and permanent, avoid putting sensitive details such as customer names in them.

Take quiz
Which bucket name is valid?
Prod Data Bucket
ab
app-logs-2026
my-google-backups
Why might your preferred bucket name already be taken?
Names expire after 90 days of inactivity
Each region reserves its own names
Names are unique only within one folder
Names are unique across all of Cloud Storage, not just your project

6. What is object versioning in Cloud Storage?

Object versioning keeps older copies of an object when it is overwritten or deleted. The live copy is the current version, and earlier ones become noncurrent. Each has a unique generation number.

Enable it per bucket:

gcloud storage buckets update gs://my-bucket --versioning

Restore an old version by copying it over the live name using its generation:

gcloud storage cp gs://my-bucket/report.csv#1712345678901234 gs://my-bucket/report.csv

Noncurrent versions are billed like normal objects, so pair versioning with lifecycle rules that cap how many versions you keep.

Take quiz
With versioning on, overwriting an object turns the old data into:
A noncurrent version with its own generation number
Permanently deleted data
A copy in a different bucket
An ACL entry
What should you add to control the cost of versioning?
A second bucket name
A lifecycle rule such as numNewerVersions
A larger bucket quota
A signed policy document

7. What is Object Lifecycle Management in Cloud Storage?

Object Lifecycle Management automates cleanup and cost savings. You define rules made of a condition (such as age or storage class) and an action (Delete, SetStorageClass, or AbortIncompleteMultipartUpload).

{"rule": [
  {"action": {"type": "SetStorageClass", "storageClass": "NEARLINE"},
   "condition": {"age": 30, "matchesStorageClass": ["STANDARD"]}},
  {"action": {"type": "Delete"}, "condition": {"age": 365}}
]}

gcloud storage buckets update gs://my-bucket --lifecycle-file=lifecycle.json

Rules run asynchronously, so an action can happen some time after the condition becomes true.

Other useful conditions include createdBefore, isLive, numNewerVersions and daysSinceNoncurrentTime, which make rules for versioned buckets possible.

Take quiz
Which lifecycle action changes an object's storage class?
Promote
Archive
SetStorageClass
Rotate
When are lifecycle actions applied?
Instantly, to the second
Only at bucket creation
Only when you run a CLI command
Asynchronously, so they can lag behind the condition

8. What is a signed URL in Cloud Storage?

A signed URL gives time-limited access to a single object to anyone who holds the link, without needing a Google account. The URL carries a cryptographic signature created with a service account's credentials, along with the allowed method (GET, PUT and so on) and an expiry time.

Create one with the CLI:

gcloud storage sign-url gs://my-bucket/invoice.pdf --duration=1h --impersonate-service-account=signer@my-project.iam.gserviceaccount.com

V4 signed URLs can last at most 7 days. The URL works only while the signing account still has permission on the object.

Take quiz
Why use a signed URL?
To give temporary access to one object without a Google account
To encrypt an object with your own key
To raise the 5 TiB object limit
To permanently make a bucket public
What is the maximum lifetime of a V4 signed URL?
30 days
7 days
365 days
24 hours

9. How do you create a bucket using the gcloud CLI?

Use gcloud storage buckets create and pass a unique name and a location:

gcloud storage buckets create gs://my-unique-bucket-2026 \
  --location=us-central1 \
  --default-storage-class=STANDARD \
  --uniform-bucket-level-access \
  --public-access-prevention

Check the result with gcloud storage buckets describe gs://my-unique-bucket-2026.

You need the storage.buckets.create permission, which comes with Storage Admin. Setting uniform access and public access prevention at creation is a safer default than fixing them later.

Location is permanent, so choose it carefully. Also pick a name that does not reveal anything sensitive, since bucket names are visible in URLs.

Take quiz
Which command creates a bucket?
gcloud bucket new --region REGION
gcloud storage create bucket NAME
gcloud storage buckets create gs://NAME --location=REGION
gsutil upload gs://NAME
Which flag disables object ACLs at creation time?
--iam-only-mode
--no-object-acl
--disable-acl-mode
--uniform-bucket-level-access

10. How do you upload and download objects using gcloud storage?

The cp command moves data in both directions, and rsync keeps two locations in sync.

# upload a file
gcloud storage cp ./report.pdf gs://my-bucket/reports/
# download it
gcloud storage cp gs://my-bucket/reports/report.pdf .
# upload a folder
gcloud storage cp -r ./site gs://my-bucket/site
# copy only what changed
gcloud storage rsync -r ./data gs://my-bucket/data

gcloud storage ls lists contents. Large transfers are parallelized automatically, which is one reason it is preferred over gsutil.

Use --dry-run with rsync to preview changes first, especially together with --delete-unmatched-destination-objects, which removes extra files from the destination.

Take quiz
Which command copies only changed files between a local directory and a bucket?
gcloud storage rsync
gcloud storage du
gcloud storage ls
gcloud storage buckets sync
Which flag makes cp copy a whole directory tree?
--tree
-r (recursive)
-d
-t

11. What is uniform bucket-level access?

Uniform bucket-level access (UBLA) turns off object ACLs, so IAM is the only system that decides who can reach a bucket and its objects. Permissions are then easy to audit, because there is one place to look.

Enable it with:

gcloud storage buckets update gs://my-bucket --uniform-bucket-level-access

Existing ACLs stop being evaluated but are kept. You can switch UBLA off again within 90 days; after that it is locked in. Google recommends UBLA for almost every new bucket.

It also simplifies compliance reviews, because an auditor only needs to inspect IAM policies instead of hunting for per-object ACL entries.

Take quiz
With UBLA enabled, access is decided by:
IAM and ACLs combined
Signed policy documents only
IAM only
ACLs only
For how long can you revert UBLA after enabling it?
30 days
7 days
It can never be reverted
90 days

12. What is the durability and availability of Cloud Storage?

Cloud Storage is designed for 99.999999999% (11 nines) annual durability across all storage classes. Data is stored redundantly, regional buckets across multiple zones and dual-region or multi-region buckets across regions, and integrity is checked with CRC32C and MD5 checksums.

Availability is a different measure. It depends on the storage class and location type, and multi-region and dual-region buckets offer higher availability than a single region. Durability is about not losing data; availability is about being able to read it right now.

Take quiz
What annual durability is Cloud Storage designed for in all classes?
99.999999999% (11 nines)
99.9%
99.99%
99.5%
What is the difference between durability and availability?
They are the same metric
Durability is about not losing data; availability is about reading it right now
Durability applies only to Archive
Availability measures how encrypted the data is

13. What is the maximum size of an object in Cloud Storage?

A single object can be up to 5 TiB. A bucket has no limit on total size or object count.

For files above a few hundred MB, use a resumable upload so a network failure doesn't force a restart from zero. Tools such as gcloud storage cp pick this automatically and can also split big files into pieces uploaded in parallel (parallel composite uploads).

The compose operation can join up to 32 source objects per request, which is how larger objects are assembled from parts.

Take quiz
What is the maximum size of one object?
1 PiB
50 GiB
5 TiB
5 GiB
Which upload method suits very large files best?
A signed policy document
A simple single-request upload
An object hold
Resumable upload

14. What is Autoclass in Cloud Storage?

Autoclass moves objects between storage classes automatically based on how often they are accessed. New objects start in Standard. With no access they step down to Nearline after 30 days, Coldline after 90 days, and optionally Archive after 365 days. When an object is read, it moves back to Standard.

It removes the need to guess access patterns and write lifecycle rules. Objects managed by Autoclass have no retrieval or early deletion fees, but the bucket pays a management fee.

gcloud storage buckets update gs://my-bucket --enable-autoclass

It suits data with unpredictable access; for patterns you know well, plain lifecycle rules can be cheaper.

Take quiz
Where do new objects start when Autoclass is on?
Standard
Archive
Coldline
Nearline
What happens to an Autoclass object when it is read after being cold?
It is deleted
It moves back to Standard
It is copied to a new bucket
It stays in Archive forever

15. What is a retention policy in Cloud Storage?

A retention policy sets a minimum age for every object in a bucket. Until an object is older than the retention period, nobody can delete or overwrite it, even with Storage Admin.

gcloud storage buckets update gs://my-bucket --retention-period=30d

An unlocked policy can be shortened, extended or removed. Once you lock it (Bucket Lock), it becomes permanent and can only be extended. This is used for WORM-style compliance such as financial or healthcare records.

The policy covers existing and new objects. Objects can be read normally, and once they reach the minimum age they can be deleted or overwritten like any other.

Take quiz
What does a retention policy prevent?
Reading objects
Changing the bucket location
Deleting or overwriting objects before they reach the minimum age
Creating new objects
What changes after a retention policy is locked?
It converts objects to Archive
It can be deleted by Storage Admin
It applies only to new buckets
It can no longer be removed or shortened

16. What is soft delete in Cloud Storage?

Soft delete keeps deleted or overwritten objects for a retention window so you can restore them. It is on by default with a 7-day window, which you can change between 7 and 90 days or turn off.

gcloud storage buckets update gs://my-bucket --soft-delete-duration=14d
gcloud storage restore gs://my-bucket/report.csv#GENERATION

Soft-deleted data is billed at normal storage rates for the window, which is worth remembering for buckets with heavy churn. Unlike versioning, it is purely time-limited and needs no cleanup rules.

This is a safety net against mistakes such as a faulty cleanup script or an accidental delete. It does not replace backups or Bucket Lock, which protect against different risks.

Take quiz
What is the default soft delete retention window?
7 days
It is off by default
30 days
1 day
Which is true of soft-deleted objects?
They cannot be restored
They are billed as storage until the window ends
They are free forever
They move to Archive automatically

17. What are the IAM roles commonly used with Cloud Storage?

Cloud Storage uses predefined IAM roles that you can grant at the project, bucket or (for supported buckets) folder level. The most common ones are:

Role What it allows
Storage Admin Full control of buckets and objects
Storage Object Admin Full control of objects only
Storage Object User Read, list, create, overwrite and delete objects
Storage Object Creator Create objects, no read or delete
Storage Object Viewer Read and list objects

Grant the narrowest role at the narrowest scope, usually on the bucket rather than the project.

Take quiz
Which role lets a service account only upload new objects?
Storage Admin
Storage Object Viewer
Storage Object Creator
Storage Object Admin
Which role can read and list objects but not change them?
Storage Object User
Storage Admin
Storage Object Creator
Storage Object Viewer

18. What is Cloud Storage FUSE?

Cloud Storage FUSE (gcsfuse) mounts a bucket as a directory on Linux or macOS, so applications can use normal file paths instead of the Cloud Storage API.

gcsfuse my-bucket /mnt/gcs

It is popular for ML training and data processing jobs that expect files, and it has a CSI driver for GKE. The catch is that it is not a full POSIX file system: there is no atomic rename on standard buckets, and latency is higher than a local disk. Caching options help with repeated reads.

Take quiz
What does Cloud Storage FUSE let you do?
Mount a bucket as a file system directory
Replicate buckets across regions
Encrypt objects with a customer key
Convert a bucket to a persistent disk
Which limitation applies to Cloud Storage FUSE?
It works only on Windows
It is not fully POSIX compliant
It can mount only Archive buckets
It requires a Filestore instance

19. What is the Storage Transfer Service?

Storage Transfer Service (STS) is a managed service for moving large amounts of data into Cloud Storage, or between buckets, without writing your own copy scripts.

Sources include Amazon S3, Azure Blob Storage, HTTP/HTTPS URL lists, other Cloud Storage buckets, and on-premises file systems through installed agents. You can schedule recurring jobs, transfer only changed files, filter by prefix, and cap bandwidth.

It handles retries and integrity checks for you, which is why it is the usual choice for cloud-to-cloud migrations.

Take quiz
Which source can Storage Transfer Service read from?
Only Persistent Disk
Only Cloud SQL
Amazon S3
Only Pub/Sub
Why use Storage Transfer Service instead of a custom script?
It converts files to Parquet
It makes objects larger than 5 TiB
It skips IAM checks
It is managed, with scheduling, retries and integrity checks

20. What is the purpose of Pub/Sub notifications for Cloud Storage?

Pub/Sub notifications let a bucket publish a message to a topic whenever something happens to an object, so downstream systems can react without polling.

Event types include OBJECT_FINALIZE (created or overwritten), OBJECT_DELETE, OBJECT_ARCHIVE and OBJECT_METADATA_UPDATE.

gcloud storage buckets notifications create gs://my-bucket --topic=uploads --event-types=OBJECT_FINALIZE

The Cloud Storage service agent needs the Pub/Sub Publisher role on the topic. A common use is triggering image processing after each upload.

Alternatives include Eventarc and Cloud Run functions triggers, which route events to services without you managing topics. Pub/Sub is best when several subscribers need the same event.

Take quiz
Which event fires when a new object is created or overwritten?
OBJECT_FINALIZE
OBJECT_CREATE_DONE
OBJECT_WRITE_COMMIT
OBJECT_SYNC
What must the Cloud Storage service agent have on the topic?
Storage Admin
The Pub/Sub Publisher role
Cloud KMS Viewer
Project Owner

21. What is the difference between Nearline, Coldline, and Archive?

All three are low-cost classes for data you rarely read. They differ in how rarely, which sets the minimum storage duration and how much you pay to retrieve data.

Nearline Coldline Archive
Min. duration 30 days 90 days 365 days
Intended access About once a month About once a quarter Less than once a year
Storage price Highest of the three Middle Lowest
Retrieval fee Lowest Higher Highest

Moving down the list lowers the storage price but raises retrieval cost and the early deletion penalty. If you read data more often than the class assumes, the retrieval fees can erase the saving. All three still return data in milliseconds.

Take quiz
Which class suits data read roughly once a quarter?
Standard
Nearline
Coldline
Archive
What trade-off comes with moving from Nearline toward Archive?
Faster reads but higher storage price
No encryption support
Smaller maximum object size
Cheaper storage but higher retrieval fees and longer minimum duration

22. What is the difference between IAM and ACLs in Cloud Storage?

IAM is Google Cloud's standard access system. It works at the project, bucket and folder levels, supports conditions, and is visible in audit tooling. ACLs are the older Cloud Storage system, applied per bucket or per object, with a small set of permissions (READER, WRITER, OWNER).

IAM ACLs
Project, bucket or folder scope Bucket or individual object
Fine-grained roles and conditions Three coarse permissions
Centrally auditable Scattered across objects
Recommended Legacy; kept for compatibility

Without UBLA, a request is allowed if either system grants it. Turning on uniform bucket-level access leaves IAM as the only authority.

In practice, enable UBLA, manage everything with IAM, and keep ACLs only for old workloads that truly depend on per-object grants.

Take quiz
Where can ACLs be applied that IAM roles usually are not?
On individual objects
On organizations
On whole projects
On VPC networks
Without UBLA, how are IAM and ACLs combined?
Both must grant it
Access is allowed if either one grants it
IAM is ignored for buckets
ACLs always override IAM

23. When would you choose a dual-region bucket with turbo replication?

Choose a dual-region bucket when you need data in two specific regions, for example for compliance, low latency from both sides, or disaster recovery with a single bucket name that survives a regional outage.

Replication between the two regions is asynchronous. By default the target is to replicate all new objects within 12 hours. Turbo replication tightens this to a 15-minute target at an extra per-GB cost.

Pick turbo when losing recent writes would hurt, such as financial exports or media pipelines. Skip it for data that is easy to regenerate, and pick a plain region if you don't need geo-redundancy at all.

Take quiz
What does turbo replication target for dual-region buckets?
A 24-hour replication window
Replication only on deletion
A 15-minute replication objective
Synchronous replication
Which workload justifies turbo replication?
Data that is easy to recreate
Temporary build caches
A single-zone test bucket
Recent writes that would be costly to lose after a regional outage

24. How does Cloud Storage provide strong consistency?

Cloud Storage guarantees strong consistency for object operations. Once a write succeeds, any later read sees the new data; the same holds for overwrites, deletes and metadata updates.

Bucket and object listings are strongly consistent too, so a list issued right after an upload includes it. This applies in regions, dual-regions and multi-regions.

The exception is access control: IAM policy changes are eventually consistent, so a newly granted role may take a short time to apply everywhere. Design startup scripts to retry on a 403 after permission changes.

This lets you build simple workflows, such as upload then immediately process, without adding sleep or polling logic.

Take quiz
After a successful upload, what will an immediate list of the bucket show?
The new object
Only its metadata
Nothing until versioning is on
It may be missing for a few minutes
Which change may take a little time to propagate?
Object listings
IAM policy updates
Object deletes
Object overwrites

25. How do resumable uploads work in Cloud Storage?

A resumable upload splits transfer into steps so it can recover from failures. The client first sends an initiation request and gets back a session URI. It then uploads the data in one or more chunks to that URI.

If the connection drops, the client asks the session how many bytes arrived, then continues from that offset instead of restarting. Chunks must be multiples of 256 KiB, except the last. A session stays valid for about a week.

sequenceDiagram
  participant C as Client
  participant G as Cloud Storage
  C->>G: POST initiate upload
  G-->>C: Session URI
  C->>G: PUT chunk 1
  Note over C,G: Connection drops
  C->>G: PUT with Content-Range bytes */* (status query)
  G-->>C: 308, bytes received so far
  C->>G: PUT remaining data from that offset
  G-->>C: 200 OK, object created

The object appears only after the final byte is received. Client libraries do all of this for you.

Take quiz
What does the client receive after initiating a resumable upload?
A signed policy document
A bucket lock token
A session URI
A KMS key name
After a dropped connection, how does the client know where to resume?
It reads the object's ACL
It restarts from byte zero
It waits for a lifecycle rule
It queries the session for bytes already received

26. Why do we use parallel composite uploads?

A single stream can't always fill a fast network link. Parallel composite uploads split a large local file into pieces, upload them simultaneously as temporary objects, then use compose to stitch them into the final object and delete the pieces.

This can speed up big files considerably on high-bandwidth connections. Trade-offs to know:

  • The result is a composite object, which has a CRC32C checksum but no MD5 hash.
  • Temporary components are created and removed, which causes extra operations.
  • Buckets with retention policies or holds can't delete those temporary pieces, so avoid the feature there.

Benchmark before adopting it, because on slow links or with small files the extra compose step may not make the upload any faster.

Take quiz
What is the final step of a parallel composite upload?
The pieces are composed into one object and the temporary parts are deleted
The object is moved to Archive
The pieces are left as separate objects
The bucket is locked
Which hash does a composite object lack?
CRC32C
MD5
Object name
Generation number

27. What happens when you overwrite an object in a versioned bucket?

The new upload becomes the live version with a fresh generation number. The previous data is not removed; it becomes a noncurrent version and stays until you or a lifecycle rule remove it.

Deleting works the same way. A plain delete on a versioned bucket does not erase data, it just turns the live object into a noncurrent one, so a normal read returns 404. Deleting with an explicit generation (object#generation) removes that version permanently.

Because every version is billed, use numNewerVersions or daysSinceNoncurrentTime lifecycle conditions to prune old copies.

To roll back, copy the noncurrent generation you want over the live name. That creates another new live generation rather than rewriting history.

Take quiz
What does a plain delete do to a live object in a versioned bucket?
It erases every version
It resets the generation to 1
It makes the live object noncurrent, keeping its data
It copies it to Archive
How do you permanently remove a specific old version?
Change the bucket location
Overwrite the live object
Disable versioning
Delete it by its generation number

28. How do you secure a Cloud Storage bucket against public exposure?

Layer several controls so one mistake doesn't leak data:

  1. Public access prevention: set to enforced on the bucket, or via the organization policy storage.publicAccessPrevention, to block allUsers and allAuthenticatedUsers.
  2. Uniform bucket-level access: removes object ACLs as a hidden path to exposure.
  3. Least-privilege IAM: avoid broad roles at the project level.
  4. Signed URLs for temporary sharing instead of making objects public.
  5. VPC Service Controls and audit logs for exfiltration protection and detection.
gcloud storage buckets update gs://my-bucket --public-access-prevention

Enforcing it at the organization level protects new buckets by default.

Review settings regularly, for example with Security Command Center findings, to catch buckets that drifted away from policy.

Take quiz
Which setting blocks allUsers from being granted access?
Public access prevention set to enforced
A lifecycle rule
Autoclass
Object versioning
What is the safer way to share one file for an hour?
Grant allUsers Storage Admin
A signed URL
Make the whole bucket public
Disable UBLA

29. What is the difference between CMEK and CSEK in Cloud Storage?

By default Google encrypts data with Google-managed keys. Two options give you more control:

CMEK CSEK
Key stored in Cloud KMS in your project Held by you, never stored by Google
How it's used Set as bucket default or per object Sent in headers with every request
Key rotation and audit Handled by KMS, with logging Your responsibility
Console support Full Limited; objects can't be managed in the console

With CMEK the Cloud Storage service agent needs the Encrypter/Decrypter role on the key, and the key must be in a location compatible with the bucket. CSEK means that losing the key makes the object unreadable, so most teams choose CMEK.

Take quiz
Where is a CMEK key managed?
Inside the object's ACL
On the client only
Cloud KMS
Cloud DNS
What happens if you lose a CSEK key?
The object falls back to Standard
Google can regenerate it
KMS restores it automatically
The encrypted object cannot be read

30. What is the difference between signed URLs and signed policy documents?

Both give access without a Google account, but they cover different jobs.

Signed URL Signed policy document
Purpose Temporary access to one object for GET, PUT or DELETE Controls what a browser form can upload
Controls Method, object, expiry Size range, content type, object name prefix, expiry
Typical use Download link, direct upload from a client HTML form POST uploads

Use a signed URL for most sharing and direct uploads. Use a policy document when a browser form posts to the bucket and you must restrict file size or type on the Cloud Storage side, for example with content-length-range.

Take quiz
Which option lets you restrict upload size for a browser form post?
Signed policy document
Signed URL
Autoclass
Object hold
Which is best for a simple time-limited download link?
Soft delete
Signed URL
Bucket Lock
Signed policy document

31. What is the difference between a retention policy and an object hold?

Both block deletion, but they work differently.

Retention policy Object hold
Scope Every object in a bucket Individual objects
Duration Fixed minimum age Until you release the hold
Types Unlocked or locked Temporary hold or event-based hold

A temporary hold is placed for things like legal discovery and lifted manually. An event-based hold ties retention to a business event; when released, the retention clock starts from that moment.

Holds and retention apply together: an object can be deleted only when it is old enough and has no hold.

Choose a retention policy for blanket rules such as keep everything for seven years, and a hold for case-specific freezes such as litigation on selected files.

Take quiz
Which of these applies to an individual object?
A bucket retention policy
Autoclass
An object hold
Uniform bucket-level access
When can an object be deleted if it has both a retention policy and a hold?
As soon as the retention period passes
As soon as the hold is released
Anytime by Storage Admin
Only when the retention period has passed and the hold is released

32. How does Bucket Lock enforce immutability?

Bucket Lock makes a bucket's retention policy permanent. After you lock it, the policy cannot be removed or shortened, only extended. Objects cannot be deleted or overwritten until their age exceeds the retention period, even by project owners.

gcloud storage buckets update gs://my-bucket --retention-period=7y
gcloud storage buckets update gs://my-bucket --lock-retention-period

The bucket also can't be deleted until all its objects have aged past the policy. That makes it suitable for WORM requirements such as SEC 17a-4 and similar regulations.

Locking is irreversible. Test the period on an unlocked bucket first, because a mistaken lock can leave you paying to store data you can't remove.

Take quiz
What can you do to a locked retention policy?
Extend it, but not remove or shorten it
Convert it to a hold
Delete it as Project Owner
Shorten it after 30 days
Why test the retention period before locking?
Locking changes the location
Locking is irreversible
Locked buckets cannot be read
Locking deletes older versions

33. When should you use Storage Transfer Service versus Transfer Appliance?

The deciding factor is how fast your network can move the data.

Storage Transfer Service Transfer Appliance
Method Online, over the network Offline, a shipped physical device
Best for Cloud-to-cloud, scheduled, up to large volumes Hundreds of TB to PB with slow or limited links
Setup Create a job; agents for on-premises Order, load locally, ship to Google

A rough test: if the transfer would take weeks or months on your available bandwidth, order an appliance. If the data sits in S3, Azure, or another bucket, or you need recurring syncs, use Storage Transfer Service.

Network egress and appliance logistics also affect cost and timelines, so estimate both before choosing.

Take quiz
Which tool ships a physical device to move data?
Cloud Storage FUSE
Storage Transfer Service
Transfer Appliance
Pub/Sub notifications
Which fits a recurring sync from Amazon S3?
Bucket Lock
Transfer Appliance
Signed policy document
Storage Transfer Service

34. How can you optimize Cloud Storage costs?

Cloud Storage bills for storage, operations, retrieval and network egress, so optimize each:

  1. Pick the right class and move cold data down with lifecycle rules, or let Autoclass do it.
  2. Prune versions and review soft delete duration on high-churn buckets.
  3. Co-locate compute and bucket to avoid cross-region egress.
  4. Abort incomplete multipart uploads with a lifecycle rule.
  5. Avoid billions of tiny objects, since each operation costs money; combine small files.
  6. Watch minimum durations: deleting early from Nearline, Coldline or Archive is still billed.
  7. Use Storage Insights and billing reports to find waste.

Regional buckets are cheaper than multi-region, so only pay for geo-redundancy where you need it.

Take quiz
Which lifecycle action stops storage charges for abandoned uploads?
AbortIncompleteMultipartUpload
Lock retention
Enable Autoclass
SetStorageClass to Standard
What helps avoid cross-region egress charges?
Enabling versioning
Placing compute in the same region as the bucket
Switching to Archive
Using more ACLs

35. How do you troubleshoot a 403 Forbidden error on Cloud Storage?

Work through the likely causes in order:

  1. Identity: confirm who is really calling (gcloud auth list, the workload's service account).
  2. Permission: check the role includes the needed permission, such as storage.objects.get, at bucket or project level, and the IAM condition isn't blocking it.
  3. Policy blockers: public access prevention, organization policies, or a VPC Service Controls perimeter.
  4. Requester pays: the call needs a billing project (--billing-project).
  5. CMEK: the caller or service agent needs access to the Cloud KMS key.
  6. Signed URLs: expired link, clock skew, or a signing account that lost access.

Policy Troubleshooter and Cloud Audit Logs show exactly which check failed. Remember that fresh IAM grants can take a short while to apply.

Take quiz
Which tool shows why an IAM access check failed?
Transfer Appliance console
Autoclass report
Policy Troubleshooter
Storage Insights inventory
A bucket has requester pays on. What does the caller need?
A larger quota
An object hold
A locked retention policy
A billing project in the request

36. How do you troubleshoot HTTP 429 errors on Cloud Storage?

A 429 Too Many Requests means you hit a rate limit rather than a permission problem. The usual causes:

  • Writing to the same object name more than about once per second.
  • Updating bucket metadata or IAM too frequently.
  • Ramping request rate up too fast against a narrow range of object names.

Fixes, in order of impact:

  1. Retry with exponential backoff and jitter; the official client libraries already do this.
  2. Stop using one object as a counter or log target. Write many distinct objects, or use a database such as Firestore for rapidly changing values.
  3. Ramp traffic gradually and spread names across different prefixes.
  4. Check the response body and Cloud Monitoring request metrics to see which limit you are hitting.
Take quiz
Which pattern commonly triggers 429 on a single object?
Rewriting the same object name more than about once per second
Adding a label to the bucket once a month
Using a regional bucket
Reading it twice a day
What is the recommended client reaction to a 429?
Disable versioning
Retry with exponential backoff and jitter
Retry immediately in a tight loop
Switch the bucket to Archive

37. Explain the lifecycle of an object across storage classes?

An object normally begins in Standard while it is hot. Lifecycle rules (or Autoclass) then move it to colder classes as it ages, and finally delete it when the retention need ends.

flowchart LR
  A["Upload: Standard"] -->|age 30 days| B[Nearline]
  B -->|age 90 days| C[Coldline]
  C -->|age 365 days| D[Archive]
  D -->|age 2555 days| E[Delete]
  B -.->|Autoclass: read again| A

With manual rules you decide the thresholds, and each change is a metadata rewrite without moving the data to another bucket. With Autoclass the transitions follow access: untouched objects step down, and an object that is read returns to Standard.

Remember minimum durations: moving or deleting before 30, 90 or 365 days is billed for the remainder.

Take quiz
What changes when a lifecycle rule moves an object from Standard to Nearline?
Its name changes
It is copied to a new bucket
Its storage class is rewritten; the bucket stays the same
It is re-encrypted with CSEK
What does Autoclass do when a Coldline object is read?
Locks it with a hold
Deletes it
Moves it to Archive
Moves it back to Standard

38. Explain the execution flow of a signed URL request?

A signed URL is created by your backend, handed to a client, and then used directly against Cloud Storage, so file bytes never pass through your server.

sequenceDiagram
  participant U as Client
  participant S as App server
  participant G as Cloud Storage
  U->>S: Request download link
  S->>S: Sign URL (service account, method, expiry)
  S-->>U: Signed URL
  U->>G: GET object using signed URL
  G->>G: Verify signature, expiry, signer's permission
  G-->>U: 200 object data (or 403)

On each request Cloud Storage recomputes the signature, checks the expiry, and confirms the signing account still has access to the object. Any mismatch, such as an altered path or clock skew, returns 403 SignatureDoesNotMatch.

Anyone with the link can use it until it expires, so keep durations short.

Take quiz
Who is checked for permission when a signed URL is used?
The service account that signed it
The client's Google account
The browser's IP address
The bucket's project owner only
What typically happens if the URL path is edited after signing?
The URL gets a longer expiry
A 403 SignatureDoesNotMatch error
The object is deleted
The edit is ignored

39. Why is a bucket's location permanent, and how do you migrate one?

The location decides where data is physically stored and replicated, so changing it would mean moving every object behind the scenes. Cloud Storage therefore treats location as fixed at creation.

To migrate:

  1. Create a new bucket in the target location, with matching settings (versioning, lifecycle, CMEK, UBLA, notifications). These settings are not copied for you.
  2. Copy the data with Storage Transfer Service or gcloud storage rsync.
  3. Re-create IAM bindings and update application references.
  4. Cut over, verify checksums, and delete the old bucket.

If you must keep the exact bucket name, copy to a temporary bucket, delete the original, recreate the name in the new location and copy back. Google also offers a bucket relocation feature for certain moves, so check current availability.

Take quiz
Which tool is suited to copying a large bucket to a new location?
Signed policy documents
Bucket Lock
Storage Transfer Service
Pub/Sub notifications
What is not carried over automatically to the new bucket?
The object bytes in copied files
The object names in copied files
The 5 TiB size limit
Settings such as lifecycle rules and IAM bindings

40. What is the difference between gsutil and gcloud storage?

gcloud storage is the current command group for Cloud Storage, built into the gcloud CLI. gsutil is the older, standalone tool that now receives only maintenance.

gcloud storage gsutil
Status Recommended, actively developed Legacy, minimal updates
Performance Parallelizes by default, usually faster Needs -m flag for parallelism
Auth and config Shares gcloud credentials Separate boto configuration
Command shape gcloud storage cp, rsync, ls gsutil cp, rsync, ls

Most commands map one to one, so migration usually means swapping the prefix and checking flag names. Use gcloud storage for all new scripts.

A few gsutil-only behaviors differ slightly, so test scripts against a non-production bucket after switching.

Take quiz
Which tool is recommended for new Cloud Storage scripts?
gcloud storage
kubectl
gsutil
bq
What does gsutil need to run transfers in parallel?
A Filestore mount
The -m flag
A paid license
Autoclass

41. How do you host a static website on Cloud Storage?

Cloud Storage can serve static files (HTML, CSS, JS, images) straight from a bucket.

  1. Create a bucket, usually named after your domain, such as www.example.com (domain ownership must be verified).
  2. Upload the site files.
  3. Set the main page and error page.
  4. Grant allUsers the Storage Object Viewer role, so public access prevention must be off for this bucket.
  5. Add a CNAME record pointing to c.storage.googleapis.com.
gcloud storage buckets update gs://www.example.com --web-main-page-suffix=index.html --web-error-page=404.html

Direct bucket hosting serves HTTP only. For HTTPS or a CDN, put an external Application Load Balancer with Cloud CDN in front of the bucket.

Remember that a public website bucket exposes every object in it, so keep private files in a different bucket.

Take quiz
Which DNS record type points a domain to a bucket for website hosting?
SRV record
TXT record only
CNAME to c.storage.googleapis.com
MX record
How do you get HTTPS for a website hosted from a bucket?
Lock the retention policy
Use a signed policy document
Enable Autoclass
Front it with a load balancer

42. When should you enable requester pays on a bucket?

With requester pays, the person or project making the request pays for operations and network egress, while the bucket owner still pays for storage.

Enable it when you share large public or partner datasets (genomics, imagery, open data) and don't want to absorb download costs for everyone. Avoid it for ordinary application buckets, since callers must jump through extra steps.

gcloud storage buckets update gs://shared-data --requester-pays
gcloud storage cp gs://shared-data/file.bin . --billing-project=my-project

Requesters must name a billing project and have serviceusage.services.use permission on it. Anonymous access is not allowed, and signed URLs and website hosting don't combine well with it.

Take quiz
Who pays for storage in a requester-pays bucket?
The bucket owner
Whoever signed the URL
Google
The requester
What must a requester include in the request?
A lifecycle rule
A billing project
An MD5 hash
A retention policy

43. How does CORS work in Cloud Storage?

Browsers block JavaScript from reading responses from another origin unless the server allows it. CORS configuration on a bucket tells Cloud Storage which origins, methods and headers are permitted.

For a preflight request, the browser sends an OPTIONS call; the bucket replies with the allowed values from its config, and the browser then makes the real request.

[{"origin": ["https://app.example.com"],
  "method": ["GET", "PUT"],
  "responseHeader": ["Content-Type"],
  "maxAgeSeconds": 3600}]

gcloud storage buckets update gs://my-bucket --cors-file=cors.json

You need it when a web app fetches or uploads objects directly from the browser, for example with signed URLs. Server-side or CLI access doesn't use CORS. Prefer exact origins over *.

Take quiz
What does CORS configuration control?
Which storage class is used
How long objects are retained
Which origins, methods and headers browsers may use against the bucket
Who can delete the bucket
When is CORS needed?
When Pub/Sub triggers a function
When a VM reads objects with gcloud
When versioning is on
When browser JavaScript accesses the bucket from another origin

44. What is the difference between Cloud Storage, Persistent Disk, and Filestore?

They store data differently and suit different access patterns.

Cloud Storage Persistent Disk Filestore
Type Object storage Block storage Managed NFS file shares
Access HTTP APIs, libraries Attached to a VM as a disk Mounted over NFS by many clients
Scale Practically unlimited Up to disk size limits Per-instance capacity
Best for Media, backups, data lakes OS and database volumes Shared files, legacy apps

Use Cloud Storage for large unstructured data and cheap durability. Use Persistent Disk when a VM needs low-latency random reads and writes. Use Filestore when several machines need a shared POSIX file system.

They are often combined, for example an application on Persistent Disk that backs up nightly to Cloud Storage.

Take quiz
Which service gives multiple VMs a shared NFS file system?
Filestore
Pub/Sub
Persistent Disk
Cloud Storage
Which is best for a VM's boot and database volume?
Filestore
Persistent Disk
Cloud Storage
Transfer Appliance

45. Why do we use hierarchical namespace buckets in Cloud Storage?

In a standard bucket, folders are only name prefixes, so renaming a folder means copying and deleting every object under it. Hierarchical namespace (HNS) buckets add real folder resources.

Benefits:

  • Atomic folder rename, which makes Hadoop/Spark commit steps and Cloud Storage FUSE operations fast and safe.
  • Higher initial request rates for workloads that touch many folders.
  • Folder-level IAM through the Storage Folder Admin role.

HNS must be chosen at bucket creation and requires uniform bucket-level access. It suits analytics and AI workloads; for plain object serving it adds little, and you should check which features it supports.

For example, renaming a Spark output folder from temporary to final becomes one quick operation instead of millions of copies.

Take quiz
What does an HNS bucket add that a standard bucket lacks?
Unlimited object size
Automatic encryption with CSEK
Real folder resources with atomic rename
Free egress
When must hierarchical namespace be enabled?
Only after 90 days
Any time with a flag
Only by deleting objects
At bucket creation

46. What is the difference between soft delete and object versioning?

Both let you recover data, but they protect against different things.

Soft delete Object versioning
Keeps Deleted or overwritten objects for a fixed window Every noncurrent version until removed
Duration 7 to 90 days, then purged automatically Indefinite unless lifecycle rules prune
Cleanup Automatic You must configure lifecycle rules
Best for Accidental deletes Version history and rollbacks

Soft delete is the simple safety net and is on by default. Versioning is better when you need many historic copies or need to restore a specific earlier state. They can be used together, and both increase storage cost.

If you only worry about mistakes in the last week or two, soft delete alone is usually enough and simpler to run.

Take quiz
Which feature automatically purges recoverable data after a fixed window?
Soft delete
Object versioning
Bucket Lock
Autoclass
Which needs lifecycle rules to prevent unbounded growth?
Soft delete
Object versioning
Requester pays
CORS

47. How can you optimize object naming for high request rates?

Cloud Storage scales request capacity automatically, but it does so by splitting the bucket's name range. If all new objects share a sequential prefix, such as a timestamp or incrementing ID, traffic concentrates on one range and may trigger 429 or 503 errors while it splits.

To spread the load:

  • Add a short hash or random prefix before sequential parts, for example a3f/2026-10-21/file.json.
  • Ramp traffic up gradually rather than starting at full volume. The initial capacity is about 1,000 writes and 5,000 reads per second per bucket.
  • Retry with exponential backoff.

The trade-off is that hashed prefixes make prefix listing by date less convenient, so keep a separate index if you need to list by time.

Take quiz
Why do sequential object names such as timestamps cause trouble at scale?
They disable versioning
They exceed the 5 TiB limit
Traffic concentrates on one name range
They break IAM
What helps distribute requests across ranges?
Enabling requester pays
Turning on Autoclass
Using longer bucket names
Adding a hash prefix

48. How do you audit access to Cloud Storage objects?

Use Cloud Audit Logs, which record who did what in Cloud Storage:

  • Admin Activity logs (bucket and IAM changes) are always on.
  • Data Access logs (ADMIN_READ, DATA_READ, DATA_WRITE) are off by default and must be enabled for the Cloud Storage service in IAM & Admin settings.

Logs flow to Cloud Logging, where you can filter on resource.type="gcs_bucket", export to BigQuery, and alert on suspicious reads.

Data Access logs on busy buckets can be large and costly, so scope them to sensitive buckets or specific principals. For inventory-style reporting, Storage Insights produces reports on objects and their metadata.

Take quiz
Which audit logs are off by default for Cloud Storage?
Data Access logs
Both are always on
Billing logs
Admin Activity logs
Where can you filter and alert on Cloud Storage audit events?
Cloud Build triggers
Cloud Logging
Filestore console
Cloud DNS

49. How does Anywhere Cache improve read performance?

Anywhere Cache adds an SSD-backed read cache in the same zone as your compute. The first read of an object comes from the bucket and fills the cache; later reads are served locally with lower latency and higher throughput.

It helps workloads that read the same data repeatedly, such as ML training epochs or large analytics jobs. It can also cut data transfer and operations charges for reads, especially when compute sits in a different region from a multi-region bucket.

gcloud storage buckets anywhere-caches create gs://my-bucket us-central1-a

You create one cache per zone, set a TTL for entries, and pay for cache capacity. It is a poor fit for write-heavy or read-once data.

Take quiz
Where is an Anywhere Cache located?
On the client's browser
In a separate project's disk
In the same zone as the compute reading the data
Inside Pub/Sub
Which workload benefits most from Anywhere Cache?
Write-once archives
Data read once a year
Single huge uploads
Repeated reads of the same data, such as ML training epochs

50. How do you restrict Cloud Storage access using VPC Service Controls?

VPC Service Controls draw a service perimeter around projects and services, including storage.googleapis.com. Even a caller with valid IAM permissions is blocked if the request comes from outside the perimeter.

Setup outline:

  1. Create a perimeter with the projects that hold your buckets.
  2. Add Cloud Storage to the restricted services list.
  3. Define access levels (for example trusted IP ranges or managed devices) and ingress/egress rules for approved flows.
  4. Test in dry-run mode, review the violation logs, then enforce.

This defends against data exfiltration through stolen credentials or misconfigured IAM. It complements IAM, it does not replace it, and rules for partners or on-prem tools need careful planning.

Take quiz
What does a VPC Service Controls perimeter block?
Requests from outside the perimeter, even with valid IAM permissions
Bucket creation by Storage Admin
Object compression
All reads inside the project
What should you do before enforcing a perimeter?
Delete all ACLs
Run it in dry-run mode and review violations
Enable Autoclass
Switch to Archive
«
»

Comments & Discussions