-
Overview
- Default original tole is project creator
- Add users as project members or bind to a resource
- Use service accounts to authenticate applications
- Member can be a Google Account, Google Group, service account, or Workspace domain
- Roles include predefined, primitive, and custom roles
- For SSH access, add SSH keys to project or instance
-
Roles
- Contains permissions suitable for a specific task
- IAM policy assigns IAM roles to members
- Controls who has what permission on which resources
- IAM ensures API request has permissions to access the resource
- Permissions are granted by setting policies
- Legacy roles are viewer, editor, owner
- Use custom roles to limit instance access to APIs
- Limit access of default service account with access scopes
- Give each instance or set of instances a unique identity
- Managed instance groups use a service account identity to manage instances
- Use broader owner, editor, or viewer roles to grant permission to perform these operations
- Use predefined roles whenever possible
- Where IAM is not supported, use a primitive roles
- If predefined or primitive roles do not meet the requirements, create custom roles
-
Policies
- Grant access by attaching IAM policies to resources
- Attach policies to resources or at project level
- Enables application of principle of least privilege
- Project level policies are inherited by child resources
- Policy is union of the policy at resource and parent
- Organization resource is the supernode in the resource hierarchy
- Projects created by domain members belong to the Organization resource
- Organization policies can restrict configurations across the resource hierarchy
-
Instances
- Add public key to project or instance for SSH access
- Avoids adding a user as a project member
- compute.instanceAdmin role grants access via SSH
- Instance must not be setup to run as a service account
- iam.serviceAccountUser role needed to run as a SA
- Project owner or editor can SSH to VM instances
- Grant SA specific IAM roles to authenticate to GCP APIs
- A service account has no user credentials
- It is ideal for server-to-server interactions
- A public key is added to the project metadata when instance is accessed via browser or gcloud
-
Audit logs
- Retain, query, process, and alert on events
- Used for forensic analysis and real-time alerting
- Used to catalog how services are used and by whom
- Google Cloud Platform logs admin activity by default
- Data access events can be optionally logged
- All console activities are logged