Associate Cloud Engineer ยท IAM policies and roles
IAM allow policies and bindings
Members, roles, bindings, conditions at a basic level, get-iam-policy and add-iam-policy-binding, etag, allow policies.
Key points
- Every resource has one allow policy.
- It is a list of bindings (principals + one role, optionally with a condition) plus an etag and a version.
- You change it by reading it, editing it and writing it back; the etag makes sure nobody else changed it in between.
Source: https://docs.cloud.google.com/iam/docs/policies
Practice questions
What does a single role binding in an allow policy connect?
- One or more principals to a single role, optionally with a condition
- One principal to every role it needs in the project
- One role to a single resource and nothing else
- A set of permissions to one project's billing account
Show answer
Answer: A. One or more principals to a single role, optionally with a condition
A binding ties principals to exactly one role. Several roles need several bindings, so the 'one principal, many roles' option is wrong.
Which statements about allow policies are correct?
- Each resource has exactly one allow policy
- A binding links principals to one role
- The etag changes every time the policy is updated
- Conditional bindings can be created with roles/editor
- Version 1 of the policy format supports conditions
Show answer
Answer: A. Each resource has exactly one allow policy, B. A binding links principals to one role, C. The etag changes every time the policy is updated
A resource has exactly one allow policy, a binding names one role, and the etag changes on every update. Version 1 does not support conditions (version 3 does), and legacy basic roles cannot be used in conditional bindings.
If a user already holds a role through an unconditional binding, adding the same role in a conditional binding limits the user's access to when the condition is true.
Show answer
Answer: False
False. Conditions do not override unconditional bindings; the unconditional grant keeps working all the time, so the conditional one adds nothing.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
