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
- 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.
How it works
Securing objects
| Control | What it does | Use |
|---|---|---|
| IAM on the bucket | Roles such as Storage Object Viewer (roles/storage.objectViewer) and Storage Object Admin | Main way to grant access |
| Uniform bucket-level access | Disables object ACLs so only IAM applies | Recommended: simpler, auditable access |
| ACLs | Per-object permissions (fine-grained access) | Legacy or special cases |
| Signed URLs | Time-limited URL granting access to one object without a Google account | Let a customer download a file for an hour |
| Public access prevention | Blocks making data public | Protect buckets from accidental exposure |
| Retention policies and object holds | Prevent deletion for a period; locked policies are permanent (WORM) | Compliance |
| Object versioning | Keeps older versions when objects are overwritten or deleted | Recover 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
"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 part | Depends on |
|---|---|
| Data storage | GB stored per month, storage class and location |
| Data retrieval | GB read from Nearline, Coldline or Archive |
| Operations | Number of requests, by operation class |
| Network egress | Data leaving the location or Google Cloud |
| Early deletion | Deleting 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:
- Create a key ring and key in Cloud KMS, in a location compatible with the bucket.
- Grant the Cloud Storage service agent the role Cloud KMS CryptoKey Encrypter/Decrypter on the key.
- 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.
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.