Roles
A role is a named bundle of permissions defined by IAM - you never assign raw permissions directly. There are exactly three kinds, and the exam loves testing "which one should you use".
- Basic roles -
roles/owner,roles/editor,roles/viewer. Project-wide, coarse, pre-date IAM. Massive scope. - Predefined roles - service-specific, curated by Google (e.g.
roles/storage.objectAdmin,roles/compute.instanceAdmin.v1). The right default for least privilege. - Custom roles - you hand-pick permissions when no predefined role fits. You maintain them.
Permission format: service.resource.verb (e.g. compute.instances.start, storage.objects.get).
A role scopes actions on the resource, not the data inside it. Example: roles/compute.viewer grants read-only get/list on Compute Engine resources - you can see instance config and list VMs, but you cannot read the data stored on their disks. Reading that data needs a separate grant.
Basic roles
The three basic roles are concentric: Owner includes everything Editor can do, and Editor includes everything Viewer can do. A project can have any number of each. Billing Administrator is separate - it manages billing and admins but cannot change resources.
Owner/Editor/Viewer apply to every resource in the project and grant far more than most tasks need. Editor can modify nearly everything; Owner also manages IAM and billing links. If an exam question offers a predefined role that fits, that beats a basic role. Reserve basic roles for tiny sandbox/test projects.
Editor can change resources but CANNOT set IAM policy. To let someone manage access without full ownership, grant roles/resourcemanager.projectIamAdmin (or the more scoped roles/iam.securityAdmin), not Owner.
Predefined roles
Google curates predefined roles per service - each bundles the permissions a real task needs, scoped to one service's resources, so it grants granular access without exposing everything else. Bind the role to a member (here a Google Group) on a project, and the member gets every permission in the bundle:
Compute Engine ships many predefined roles; three commonly tested ones:
roles/compute.storageAdmin manages Compute Engine disks, images, and snapshots - NOT Cloud Storage buckets (that is roles/storage.admin). Use it to let someone manage project images without granting Editor on the project.
Network Admin deliberately excludes write access to firewall rules and SSL certificates - it gets read-only there. Firewall changes belong to a separate role such as Security Admin.
Custom roles
When no predefined role fits, define a custom role with exactly the permissions you need. This is how orgs enforce least privilege - each identity gets only the minimum to do its job.
Create one in the console
IAM & Admin ▸ Roles ▸ Create role. You either start from scratch or select an existing role and create a copy, then add or remove permissions - the demo builds Instance Operator from scratch.
The picker holds 2,000+ permissions, so filter by prefix (compute.instances.) to narrow to the ~44 that apply. The demo's Instance Operator grants get, list, reset, resume, start, stop, and suspend - enough to operate VMs (including waking a suspended one with resume) but not reconfigure or delete them.
The Title and launch stage can change later, but the ID must be unique and cannot be changed after creation. The console launch-stage dropdown offers only Alpha, Beta, General Availability, and Disabled - start at Alpha and promote as you test it.
- Defined at organization or project level only (not folder).
- Built from allowed permissions; a permission must be in a supported stage (permissions can be
SUPPORTED,TESTING, orNOT_SUPPORTEDfor custom roles). - Have a
stage:EAP→ALPHA→BETA→GA→DEPRECATED→DISABLED(setDISABLEDto turn a custom role off without deleting it). - You own maintenance - Google adds new permissions to predefined roles automatically, but NOT to your custom roles.