IAM overview (original) (raw)

This page describes how Google Cloud's Identity and Access Management (IAM) system works and how you can use it to manage access in Google Cloud.

IAM is a tool to manage fine-grained authorization for Google Cloud. In other words, it lets you control who can do _what_on which resources.

Access in Google Cloud

Every action in Google Cloud requires certain permissions. When someone tries to perform an action in Google Cloud—for example, create a VM instance or view a dataset—IAM first checks if they have the required permissions. If they don't, then IAM prevents them from performing the action.

Giving someone permissions in IAM involves the following three components:

To give the principal permission to access the resource, you grant them a role on the resource. You grant these roles using an allow policy.

Allow policies are directly attached to some Google Cloud resources, which are organized hierarchically—for example, projects contain service-specific resources. This means that you can grant access to a single resource or a container of resources.

The following sections describe these concepts in more detail.

Principals

In Google Cloud you control access for principals. Principals represent one or more identities that have authenticated to Google Cloud.

In the past, principals were referred to as members. Some APIs still use that term.

There are various types of principals in IAM, but they can be divided into two broad categories:

For more information about principals, see IAM principals.

Permissions and roles

Permissions determine what operations are allowed on a resource. In IAM, permissions are typically represented in the formservice.resource.verb. Often, permissions correspond one-to-one with REST API methods—for example, theresourcemanager.projects.list permission lets you list Resource Manager projects.

You can't directly grant permissions to a principal. Instead, you give principals permissions by granting them roles.

Roles are collections of permissions. When you grant a role to a principal, you give that principal all of the permissions in that role.

There are three types of roles:

For more information about roles and permissions, see Roles and permissions.

Resources

Most Google Cloud services have their own resources. For example, Compute Engine has resources like instances, disks, and subnetworks.

In IAM, you grant roles on a resource. Granting a principal a role on a resource means that the principal can use the permissions in that role to access the resource.

You can grant roles on a subset of Google Cloud resources. For a full list of resources that you can grant roles on, see Resource types that accept allow policies.

Google Cloud also has container resources, including projects, folders, and organizations. These container resources are organized hierarchically, which lets child resources inherit the policies of their parent resources. This means that granting a principal a role on a container resource gives the principal access to both the container resource and the resources in that container. This feature lets you use a single role grant to manage access to multiple resources, including resources that you can't grant roles on directly. For more information, see Policy inheritance on this page.

Allow policies

You grant roles to principals using allow policies. In the past, these policies were referred to as IAM policies.

An allow policy is a YAML or JSON object that's attached to a Google Cloud resource.

The following diagram shows how an allow policy is structured:

An allow policy with two role bindings. The role bindings
  associate specific principals with specific roles.

Each allow policy contains a list of role bindings that associate IAM roles with the principals who are granted those roles.

When an authenticated principal attempts to access a resource, IAM checks the resource's allow policy to determine whether the principal has the required permissions. If the principal is in a role binding that includes a role with the required permissions, then they're allowed to access the resource.

To see examples of allow policies and learn about their structure, seeUnderstanding allow policies.

Policy inheritance

Google Cloud has container resources—such as projects, folders, and organizations—that let you organize your resources in a parent-child hierarchy. This hierarchy is called the resource hierarchy.

The Google Cloud resource hierarchy has the following structure:

The following diagram is an example of a Google Cloud resource hierarchy:

Hierarchy for IAM resources.

If you set an allow policy on a container resource, then the allow policy also applies to all resources in that container. This concept is called policy inheritance, because descendant resources effectively inherit their ancestor resources' allow policies.

Policy inheritance has the following implications:

For more information about policy inheritance for allow policies, seeUsing resource hierarchy for access control.

Advanced access control

In addition to allow policies, IAM provides the following access control mechanisms to help you refine who has access to what resources:

Consistency model for the IAM API

The IAM API iseventually consistent. In other words, if you write data with the IAM API, then immediately read that data, the read operation might return an older version of the data. The changes that you make might also take time to affect access checks.

This consistency model affects how the IAM API works. For example, if you create a service account, then immediately refer to that service account in another request, the IAM API might say that the service account couldn't be found. This behavior occurs because operations are eventually consistent; it can take time for the new service account to become visible to read requests.

What's next

Try it for yourself

If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.

Get started for free