Bitzu

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

Single choice

What does a single role binding in an allow policy connect?

  1. One or more principals to a single role, optionally with a condition
  2. One principal to every role it needs in the project
  3. One role to a single resource and nothing else
  4. 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.

Select all that apply

Which statements about allow policies are correct?

  1. Each resource has exactly one allow policy
  2. A binding links principals to one role
  3. The etag changes every time the policy is updated
  4. Conditional bindings can be created with roles/editor
  5. 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.

True or false

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.

Download on the App StoreGet it on Google Play

More Associate Cloud Engineer topics in this module