Prepare and test your skills

Prepare and test your skills

Implementing access control and security policies in Cloud Storage (opens in a new tab) means deciding which principals can access a bucket and the objects inside it. Cloud Storage stores data as objects inside containers called buckets, and every bucket belongs to a project that belongs to an organization. Access is controlled by Identity and Access Management (IAM) (opens in a new tab) roles at the bucket level, by Access Control Lists (ACLs) at the object level, and by a bucket setting that selects which model applies.
Identity and Access Management (IAM) is the primary permission system for Cloud Storage buckets and objects. An administrator grants an IAM role to a principal, and the role carries a bundle of permissions such as reading, writing, or administering data. The Storage Admin role contains the permissions needed to set and manage access on a bucket, and custom IAM roles can be created when no predefined role fits.
Managing uniform bucket-level access requires three specific bucket permissions:
storage.buckets.get to read the bucket configurationstorage.buckets.list to find the bucket when using the Google Cloud consolestorage.buckets.update to change the bucket access settingThese permissions can come from the Storage Admin role or from a custom role that includes them. IAM policies identify resources by name, where bucket resources use the form projects/_/buckets/BUCKET_NAME and object resources use the form projects/_/buckets/BUCKET_NAME/objects/OBJECT_NAME.
Access Control Lists (ACLs) are per-object permission entries that grant access to a single object in a bucket. Each bucket can also have a default object ACL that is automatically applied to new objects created in that bucket. Because ACLs attach to individual objects, different objects in the same bucket can have different readers or owners.
ACL-based access creates extra management work because permissions must be checked object by object rather than once at the bucket. Cloud Monitoring can check whether ACLs are still in use through the metric storage.googleapis.com/authz/acl_operations_count on the GCS Bucket resource. If that metric shows ACL operations, workflows still depend on object ACLs and will break if ACLs are disabled.
Uniform bucket-level access is a bucket setting that places all Cloud Storage access under bucket-level IAM roles. When uniform bucket-level access is enabled, only bucket-level IAM roles grant access to the bucket and its objects, and individual object ACLs no longer apply. Fine-grained access is the alternative model where both bucket-level IAM roles and per-object ACLs grant access, so permissions can vary from object to object.
| Access model | How access is granted | Management tradeoff |
|---|---|---|
| Uniform bucket-level access | Only bucket-level IAM roles grant access to the bucket and all objects | Simpler and more consistent, and required to use managed folders |
| Fine-grained access | Bucket-level IAM roles plus individual and default object ACLs grant access | Allows per-object control, but requires tracking many separate objects |
Choose uniform bucket-level access when every object in a bucket should share the same rules and simpler administration is preferred. Choose fine-grained access only when different objects in the same bucket must have different permissions that bucket-level IAM cannot express. Blocking public access is a related best practice that prevents data from becoming accessible to everyone on the internet.
Exam tip: Enabling uniform bucket-level access disables object ACLs, and uniform bucket-level access is required to use managed folders.
Managed folders are Cloud Storage resources that grant or revoke additional access beyond the IAM permissions set on the bucket. A managed folder does not create a true directory tree for storing data; it acts as a permission overlay used only for access checks. A request flows from the principal to the bucket IAM policy and then to any managed folder policy that applies, so the managed folder policy can expand on what the bucket policy allows.
Managed folders depend on the bucket using uniform bucket-level access, because the bucket must have a single IAM-based system for the overlay to extend. This dependency makes uniform bucket-level access the foundation for organizing access by groups of objects without returning to per-object ACLs.
Managing object lifecycle and storage classes in Cloud Storage (opens in a new tab) means controlling where object data lives and how long it lives to balance cost and performance. Buckets hold objects as immutable data, and each bucket has a storage class and location that set durability and availability. Object Lifecycle Management applies bucket-level rules that automatically move objects to colder classes or expire them when conditions are met.
Object Lifecycle Management is a bucket configuration that automatically acts on objects when they match conditions such as age or storage class. A rule pairs one or more conditions with an action, and Cloud Storage evaluates live objects and applies the action without a manual delete or rewrite. The two cost-focused actions are SetStorageClass to transition an object, for example from Standard to Archive storage, and Delete to expire an object. Because the rules run continuously, new objects that age into a condition are handled the same way as older objects.
Lifecycle rules fit predictable, repeating patterns rather than one-time cleanup:
When deletion must happen only after human review or for a few named files, single-object deletion or interactive bulk delete is more direct than a lifecycle rule. When the trigger is object age, time since creation, or storage class, a lifecycle rule removes the need for scripts or scheduled jobs.
Storage class transitions move object data to a cheaper class for less-frequently accessed data while keeping the same object name and bucket location. Changing the storage class rewrites the data, which is a Class A operation that can incur extra charges depending on age, location, and storage class. At very large scale, Storage batch operations can change classes in bulk, for example moving millions of Standard objects to Archive, and can also bulk delete live objects or permanently delete noncurrent versions.
Object state determines what a transition or expiration affects. An object is live while it is the current version, becomes noncurrent when Object Versioning retains an older generation after a rewrite, and becomes soft-deleted for seven days by default after deletion before permanent removal. If versioning is enabled, a storage-class rewrite leaves the original data as a noncurrent version until it is explicitly deleted. Holds, retention policies, and Bucket Lock can block deletion, so lifecycle expiration and batch deletion depend on those protections being cleared first.
Exam tip: Choose Object Lifecycle Management when deletion or transition is automatic based on conditions such as age or storage class; choose manual or batch tools when deleting a known set of objects one time.
Choosing a deletion method depends on object count, whether selection is by name or by condition, and whether the work is interactive or asynchronous with tracking. Single-object deletion sends an individual DELETE request per object for precise updates such as fixing an upload error. Bulk object deletion processes many objects together for higher throughput and reduced overhead.
| Method | Best for | How it works |
|---|---|---|
| Single-object deletion | One object or a small number of specific objects | Each tool sends an individual DELETE request per object through the console, gcloud storage rm, client libraries, or REST APIs |
| Bulk object deletion | Many objects at once or automatic expiration | The service processes many objects together through prefix deletes, multi-object requests, background console jobs, batch operations, or lifecycle rules |
After the method is chosen, the tool follows from scale and workflow. The Google Cloud console deletes up to one million objects interactively in the background with status in Notifications, gcloud storage rm --recursive deletes objects that share a common prefix for small to medium jobs, and the multi-object delete XML API deletes up to 1,000 objects in a single POST request and works with Amazon S3 tools such as Boto3. Storage batch operations (opens in a new tab) deletes millions or billions of objects asynchronously with tracking, but a job has a maximum lifetime of 14 days, spans at most 1,000 buckets, allows at most 1,000 object prefixes, and degrades if more than 10 concurrent jobs run on the same bucket.
Ensuring data integrity and availability in Cloud Storage (opens in a new tab) means keeping object data correct, recoverable, and reachable only by the right people for the right amount of time. Object Versioning keeps version history for version control, encryption keys control who can read stored data, and Signed URLs grant temporary access to private objects without making a bucket public.
Object Versioning is a bucket data-protection setting that keeps version history for version control. When versioning is enabled, the configuration specifies the maximum number of versions kept per object and the number of days after which noncurrent versions expire. The bucket stores the live version and older noncurrent versions together, so an overwrite does not immediately remove the previous data. Once a noncurrent version passes its expiration age or exceeds the maximum count, Cloud Storage removes that older version.
Encryption in Cloud Storage protects object data by requiring the correct key to decrypt and read an object. Different objects in a single bucket can use different encryption methods, but a single object can only be encrypted by one method at a time. If a bucket has a default customer-managed encryption key (CMEK) and a request also supplies a customer-supplied key, Cloud Storage uses the customer-supplied key for that object.
Cloud Key Management Service (Cloud KMS) (opens in a new tab) keys used by Cloud Storage have versions, including a primary version used for new encryption. After rotation, Cloud Storage uses the new primary version for new uploads, copies, and rewrites, while previous versions remain available so existing objects can still be decrypted. Replacing an old key with a new key follows an ordered process:
Disabling or destroying a key version blocks access to objects encrypted with that version, but the two actions differ in recovery:
| Action | Effect on encrypted objects | Recovery |
|---|---|---|
| Disable key version | Downloads, copies, and rewrites of objects encrypted with that version fail with an error | Re-enable the version to restore access |
| Destroy key version | Downloads of objects encrypted with that version are never possible again | No recovery; data loss is permanent |
Destroying a key version that still protects objects can cause permanent loss, except in certain cases involving locked objects. Disabling or destroying the primary version also stops new encryption with that key until a new primary version exists, so uploads to a bucket that uses that key as its default fail unless the request specifies a different, valid key.
Exam tip: Disabling a Cloud KMS key version is reversible by re-enabling it, while destroying a key version permanently prevents downloads of objects encrypted with that version.
A Signed URL is a time-limited, narrowly scoped URL that grants access to a private Cloud Storage object to anyone who holds the URL. A service account with permission to sign creates the URL for a specific bucket, object, HTTP method, and expiration time, and then an external user presents that URL directly to Cloud Storage using any user agent such as curl. Cloud Storage checks the signature and expiration before allowing the action, so the external user needs no Google account and no change to bucket IAM.
The trust boundary stays with the signing service account, not the external user. Public access prevention (opens in a new tab) does not block Signed URLs because access comes from scoped service account permissions, while requests authorized as allUsers or allAuthenticatedUsers fail with HTTP 401 or 403 when prevention is enforced. A GET Signed URL allows temporary download of an object such as cat.jpeg for a set period such as 10 minutes or 1 hour, while a PUT Signed URL allows temporary upload of an object such as cat.png with a required content type such as application/octet-stream or image/png.
Signing a URL requires credentials authorized to sign, supplied through one of these options:
iam.serviceAccounts.signBlob permissionIf the client library uses the same authentication that created the Storage client, that authentication must include a private key or have iam.serviceAccounts.signBlob permission for signing to succeed.
Uniform bucket-level access grants access only through bucket-level Identity and Access Management (IAM) roles and disables object Access Control Lists (ACLs), while fine-grained access grants access through both bucket-level IAM roles and per-object ACLs. Choose uniform bucket-level access when every object in a bucket should share the same rules and simpler administration is preferred, and choose fine-grained access only when different objects in the same bucket must have different permissions that bucket-level IAM cannot express. Uniform bucket-level access is also required to use managed folders.
Object Lifecycle Management should be used when deletion or storage class transition is automatic based on conditions such as age or storage class, because its bucket-level rules pair conditions with SetStorageClass or Delete actions and run continuously without manual deletes or rewrites. Manual or single-object deletion is more direct when deletion must happen only after human review or for a few named files, or when deleting a known set of objects one time. Single-object deletion sends an individual DELETE request per object, while bulk deletion processes many objects together through prefix deletes, multi-object requests, background console jobs, batch operations, or lifecycle rules.
Disabling a key version causes downloads, copies, and rewrites of objects encrypted with that version to fail with an error, but access can be restored by re-enabling the version. Destroying a key version makes downloads of objects encrypted with that version never possible again, so data loss is permanent except in certain cases involving locked objects. Disabling or destroying the primary version also stops new encryption with that key until a new primary version exists.
A Signed URL is a time-limited, narrowly scoped URL that grants access to a specific private Cloud Storage object for a specific HTTP method and expiration time to anyone who holds the URL. A service account with permission to sign creates the URL for a specific bucket, object, HTTP method, and expiration time, and Cloud Storage checks the signature and expiration before allowing the action. The external user needs no Google account and no change to bucket IAM is required, and public access prevention does not block Signed URLs because access comes from scoped service account permissions.
You are managing permissions for a data analyst who needs access to resources in your Google Cloud project.
The analyst has the following requirements:
reports-bucket.Following the principle of least privilege, how should you configure IAM roles for this user?
Grant the Storage Legacy Bucket Reader (roles/storage.legacyBucketReader) role at the project level, and grant the Storage Legacy Object Owner (roles/storage.legacyObjectOwner) role at the bucket level for reports-bucket.
Grant the Storage Admin (roles/storage.admin) role at the project level, and configure a bucket Access Control List (ACL) to restrict write access to reports-bucket.
Grant the Storage Object Viewer (roles/storage.objectViewer) role at the project level, and grant the Storage Object Creator (roles/storage.objectCreator) role at the bucket level for reports-bucket.
Grant the Storage Object Creator (roles/storage.objectCreator) role at the project level, and grant the Storage Object Viewer (roles/storage.objectViewer) role at the bucket level for reports-bucket.
Last updated