GCP - Associate Cloud Engineer Study Guide

    4: Configuring access and security

    This chapter covers the access and security model that sits underneath every other Google Cloud surface: how Identity and Access Management policies are read, written, and inherited across the Organization, Folder, Project, and resource layers; how the basic, predefined, and custom role types differ and when to author your own; and how service accounts are created, granted minimum permissions, attached to resources, governed by their own IAM policies, impersonated by humans and other workloads, and consumed through short-lived credentials issued by the IAM Credentials API and Workload Identity Federation.

    Learning Objectives

    By the end of this chapter, you will be able to:

    • View, edit, and create IAM policies at the Organization, Folder, Project, and resource level using both the Google Cloud Console and gcloud commands.
    • Distinguish basic, predefined, and custom roles, choose between them by blast radius and operational cost, and author custom roles bound to a specific permission set.
    • Create user-managed service accounts and identify the default and Google-managed service accounts that Google Cloud provisions automatically.
    • Bind service accounts as principals with the minimum predefined or custom roles that match the workload's API surface.
    • Attach service accounts to Compute Engine instances, Google Kubernetes Engine node pools, Cloud Run services, Cloud Run jobs, Cloud Run functions, Cloud Build pipelines, and Eventarc triggers.
    • Manage the IAM policy attached to a service account itself, including roles/iam.serviceAccountUser, roles/iam.serviceAccountTokenCreator, and roles/iam.workloadIdentityUser.
    • Configure single-step and chained service account impersonation for human operators and for automated callers.
    • Issue short-lived access tokens, ID tokens, JWTs, and signed blobs through the IAM Credentials API, and federate external identities into Google Cloud with Workload Identity Federation.

    Executive Summary

    • An IAM policy is a list of role bindings attached to a resource node; the effective policy for any operation is the union of every binding inherited from the Organization down to the leaf resource, filtered by any Deny policy that matches the principal.
    • Predefined roles are the default choice; basic roles cover too much surface, and custom roles cost ongoing maintenance because new permissions added to the platform are not auto-included.
    • A service account is BOTH a principal (it can be granted roles) AND a resource (it has its own IAM policy that controls who can act as it). The two policy surfaces are managed separately and routinely confused.
    • Service account impersonation and Workload Identity Federation replace JSON key files for nearly every supported use case; the iam.disableServiceAccountKeyCreation organization policy enforces this decision.
    • Short-lived credentials issued through the IAM Credentials API have a default one-hour access token lifetime and can be extended to twelve hours with an organization policy; ID tokens follow the same lifetime envelope.

    Assumptions

    • The landing zone, billing, observability, and workload placement from earlier chapters are in place. The reader has a Project linked to a Cloud Billing account, an Organization node, and at least one Compute Engine instance, one GKE cluster, and one Cloud Run service to attach identities to.
    • All gcloud examples assume a configuration with a default Project and region already set via gcloud config set project and gcloud config set compute/region. Where a command targets a different scope, the scope flag is shown explicitly.
    • Terms defined in earlier chapters (principal, role, permission, binding, predefined role, custom role, IAM Deny policy, conditional binding, default service account, service agent, Workload Identity Federation, Identity-Aware Proxy) are reused without redefinition.

    Sections in this chapter

    1. Free
    2. Free with account
    3. Free with account
    4. Free with account
    5. Free with account
    6. Free with account
    7. Free with account
    8. Free with account
    9. Free with account