Ensuring the successful operation of a cloud solution · Topic 4 of 8

Managing Cloud Storage

Securing Cloud Storage objects with IAM, uniform access and signed URLs, lifecycle policies, estimating storage costs and customer-managed keys.

  • 4 min
In a nutshell
  • Prefer IAM with uniform bucket-level access; use signed URLs for temporary access; public access prevention blocks exposure.
  • Lifecycle rules change class or delete by age, versions, date or class.
  • Storage costs: storage, retrieval, operations, egress, early deletion.

What it is

Operating Cloud Storage means controlling who can access objects, automating lifecycle changes such as moving or deleting old data, estimating costs, and protecting data with customer-managed encryption keys (CMEK) where required.

New objectStandardafter 30 daysNearlineafter 90 daysColdlineafter 365 daysDelete

How it works

Securing objects

ControlWhat it doesUse
IAM on the bucketRoles such as Storage Object Viewer (roles/storage.objectViewer) and Storage Object AdminMain way to grant access
Uniform bucket-level accessDisables object ACLs so only IAM appliesRecommended: simpler, auditable access
ACLsPer-object permissions (fine-grained access)Legacy or special cases
Signed URLsTime-limited URL granting access to one object without a Google accountLet a customer download a file for an hour
Public access preventionBlocks making data publicProtect buckets from accidental exposure
Retention policies and object holdsPrevent deletion for a period; locked policies are permanent (WORM)Compliance
Object versioningKeeps older versions when objects are overwritten or deletedRecover from mistakes
gcloud storage buckets add-iam-policy-binding gs://reports-1234 \
  --member="group:analysts@example.com" --role="roles/storage.objectViewer"

gcloud storage buckets update gs://reports-1234 --uniform-bucket-level-access
gcloud storage sign-url gs://reports-1234/q3.pdf --duration=1h --private-key-file=key.json
Exam tip

"Give an external customer temporary access to a single file" is a signed URL, not a public bucket.

Lifecycle management

Object Lifecycle Management applies rules to objects automatically: change storage class or delete based on conditions such as age, creation date, number of newer versions or storage class.

{
  "rule": [
    {"action": {"type": "SetStorageClass", "storageClass": "NEARLINE"}, "condition": {"age": 30}},
    {"action": {"type": "SetStorageClass", "storageClass": "COLDLINE"}, "condition": {"age": 90}},
    {"action": {"type": "Delete"}, "condition": {"age": 365}}
  ]
}
gcloud storage buckets update gs://logs-1234 --lifecycle-file=lifecycle.json

With versioning, a rule such as numNewerVersions deletes old versions so costs do not grow forever. Use Autoclass instead of rules when access patterns are unknown.

Estimating storage costs

Cloud Storage cost has several parts:

Cost partDepends on
Data storageGB stored per month, storage class and location
Data retrievalGB read from Nearline, Coldline or Archive
OperationsNumber of requests, by operation class
Network egressData leaving the location or Google Cloud
Early deletionDeleting before the class's minimum storage duration

Use the Google Cloud Pricing Calculator to estimate, and billing reports to track actual costs. The same approach applies to database storage: size, replication and backups drive cost.

Customer-managed encryption keys (CMEK)

All data is encrypted at rest by default with Google-managed keys. CMEK uses keys you control in Cloud KMS:

  1. Create a key ring and key in Cloud KMS, in a location compatible with the bucket.
  2. Grant the Cloud Storage service agent the role Cloud KMS CryptoKey Encrypter/Decrypter on the key.
  3. Set the key as the bucket's default key.
gcloud storage buckets update gs://records-1234 \
  --default-encryption-key=projects/PROJECT/locations/us-central1/keyRings/ring/cryptoKeys/records-key

CMEK gives control over rotation and the ability to disable the key, which makes data unreadable. Other services such as BigQuery, Cloud SQL and Compute Engine disks support CMEK in a similar way.

A worked scenario

A company stores application logs that are read for a month and kept for a year. It sets a lifecycle policy moving logs to Nearline at 30 days, Coldline at 90 days and deleting at 365 days. Its HR bucket uses uniform bucket-level access, public access prevention and a CMEK key from Cloud KMS. Auditors receive signed URLs valid for one day. Before the change, the team estimated savings with the Pricing Calculator.

How the exam asks about this

  • "Delete objects older than a year automatically." A lifecycle rule with an age condition.
  • "Only IAM should control access to the bucket." Uniform bucket-level access.
  • "Temporary download link without a Google account." A signed URL.
  • "The company must control and rotate its own encryption keys." CMEK with Cloud KMS.

What to remember for the exam

  • Prefer IAM with uniform bucket-level access; use signed URLs for temporary access; public access prevention blocks exposure.
  • Lifecycle rules change class or delete by age, versions, date or class.
  • Storage costs: storage, retrieval, operations, egress, early deletion.
  • CMEK: Cloud KMS key, grant the service agent Encrypter/Decrypter, set as default key.
Watch out

If a CMEK key is disabled or destroyed, the data it protects cannot be read. Manage keys carefully.

Common mistakes

Making a bucket public to share one file. Use a signed URL.

Forgetting the service agent permission for CMEK. Without it, writes fail.

Ignoring retrieval and early deletion fees when choosing cold classes. They can outweigh savings.

Check yourself

  • How can you give someone time-limited access to one object without an account?

    Create a signed URL for the object.

  • What does uniform bucket-level access do?

    It disables object ACLs so that access is controlled only by IAM.

  • Which role must the Cloud Storage service agent have on a CMEK key?

    Cloud KMS CryptoKey Encrypter/Decrypter.

Topic 4 of 8 in Ensuring the successful operation of a cloud solution

Test yourself on Ensuring the successful operation of a cloud solution

The full Google Cloud Associate Cloud Engineer question bank has 661 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Google Cloud. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.