What if one wrong key could unlock your entire cloud system? Learn how IAM and ACLs prevent that.
Access control (IAM vs ACLs) in GCP - When to Use Which
Start learning this pattern below
Jump into concepts and practice - no test required
Imagine you have a big office building with many rooms. You want to decide who can enter each room. If you write down on paper who can enter each door and hand out keys manually, it quickly becomes confusing and hard to manage.
Manually tracking who has access to each room means you can easily lose track, give wrong permissions, or forget to update when someone leaves. It's slow, mistakes happen, and security risks grow.
Access control systems like IAM and ACLs let you manage permissions centrally and clearly. IAM lets you assign roles to people or groups, controlling what they can do across many resources. ACLs let you set specific permissions on individual items. Together, they make access safe, simple, and scalable.
Give key to Alice for Room A Give key to Bob for Room B Write down permissions on paper
IAM: Assign 'Viewer' role to Alice ACL: Set read permission for Bob on File X
With IAM and ACLs, you can easily control who can see or change your cloud resources, keeping your data safe and your team productive.
A company uses IAM to let developers deploy apps but only lets finance team view billing info. ACLs control who can read or write specific files in cloud storage.
Manual access control is confusing and risky.
IAM and ACLs provide clear, centralized permission management.
They help keep cloud resources secure and easy to manage.
Practice
Solution
Step 1: Understand IAM scope
IAM controls access broadly by assigning roles to users or groups at resource levels like projects or services.Step 2: Understand ACL scope
ACLs control access more narrowly, typically at the object or bucket level in storage services.Final Answer:
IAM manages access at resource levels using roles, while ACLs manage access at object or bucket levels. -> Option DQuick Check:
IAM = broad roles, ACLs = fine-grained object permissions [OK]
- Confusing IAM with network controls
- Thinking ACLs control passwords
- Assuming IAM and ACLs are identical
Solution
Step 1: Identify IAM command syntax
The correct gcloud command to grant IAM roles uses 'add-iam-policy-binding' with member and role flags.Step 2: Verify role and member format
The role 'roles/storage.objectViewer' and member format 'user:email@example.com' are correct for granting read access to storage objects.Final Answer:
Use the command: gcloud projects add-iam-policy-binding my-project --member='user:email@example.com' --role='roles/storage.objectViewer' -> Option CQuick Check:
IAM role grant uses gcloud add-iam-policy-binding [OK]
- Confusing ACL changes with IAM commands
- Editing passwords instead of roles
- Using firewall rules for access control
{
"bindings": [
{
"role": "roles/storage.objectAdmin",
"members": ["user:alice@example.com"]
}
]
}Solution
Step 1: Identify the role assigned
The role 'roles/storage.objectAdmin' allows full control over objects in the bucket, including create, delete, and update.Step 2: Confirm member access
The member 'user:alice@example.com' is assigned this role, so Alice has these permissions.Final Answer:
Alice can create, delete, and update objects in the bucket. -> Option BQuick Check:
roles/storage.objectAdmin = full object control [OK]
- Confusing objectAdmin with read-only roles
- Assuming no access without explicit bucket ACL
- Mixing IAM roles with IAM policy management
Solution
Step 1: Understand uniform bucket-level access
When uniform bucket-level access is enabled, ACLs are disabled and only IAM controls access.Step 2: Check ACL effect
Adding users to ACLs has no effect if uniform bucket-level access is on, so the user cannot access objects despite ACL changes.Final Answer:
The bucket has uniform bucket-level access enabled, which disables ACLs. -> Option AQuick Check:
Uniform bucket-level access disables ACLs [OK]
- Assuming ACLs always work regardless of bucket settings
- Blaming user typos without verification
- Thinking user restart affects cloud permissions
Solution
Step 1: Understand access scope needs
The third-party service needs access only to specific objects, not the whole project.Step 2: Choose fine-grained control method
ACLs allow granting permissions on specific objects or buckets, ideal for limited access.Step 3: Evaluate other options
IAM roles at project level are too broad; storage.admin is too powerful; firewall rules do not control storage access.Final Answer:
Add the service account to the bucket's ACL with READER permission on specific objects. -> Option AQuick Check:
Use ACLs for fine-grained object access [OK]
- Granting overly broad IAM roles
- Confusing firewall rules with access control
- Using storage.admin role unnecessarily
