Google Cloud¶
Scope: workloads on Google Cloud, from a single project to an enterprise organization. Cloud-neutral rules live elsewhere: least privilege (SEC-1) and secrets management (SEC-2) in Security, SLOs, resilience and monitoring in Operations and reliability, Terraform itself in Terraform, and pipelines that deploy to Google Cloud in GitHub Actions. For the other clouds, see AWS and Microsoft Azure.
Entries are sorted by score from 1 to 10 (criteria): 9โ10 start here or strongly recommended, 6โ8 recommended, 1โ5 further reading or conditional.
Adopted references¶
- 10 Google Cloud Well-Architected Framework: the baseline, used for every workload review. Its pillars each have principles and recommendations:
- 8 Security, privacy and compliance
- 8 Reliability
- 7 Operational excellence
- 7 Cost optimization
- 7 Performance optimization
- 5 Sustainability
- 9 Enterprise foundations blueprint: the baseline for the organization: resource hierarchy, identity, networking, detective and preventative controls, and a GitOps deployment pipeline, with a deployable Terraform implementation in terraform-example-foundation.
- 8 Landing zone design in Google Cloud: a series on the decisions behind a landing zone: identity onboarding, resource hierarchy, network design and security.
- 8 Best practices for using service accounts securely (IAM): choosing, managing and limiting service accounts. Read it with the best practices for managing service account keys and for Workload Identity Federation.
- 7 Google Cloud infrastructure reliability guide: the building blocks of reliability (zones, regions and location-scoped resources), the availability they provide, and how to design reliable infrastructure. Read it with the deployment archetypes and Architecting disaster recovery for cloud infrastructure outages.
- 7 Cloud Architecture Center: reference architectures, design guides and best practices.
Key rules¶
Resource hierarchy¶
- 8
GCP-1Use one organization resource, with folders for environments or other policy boundaries, and a separate project for each workload in each environment. Design the hierarchy around policies and access, not around the company's org chart. (Decide a resource hierarchy for your landing zone, Enterprise foundations blueprint, Organization structure) - 6
GCP-2Label projects and resources consistently, for example with application, environment, cost center and owner, and set the labels from infrastructure as code. Billing reports can break costs down by label. Never put sensitive data in labels. (Enterprise foundations blueprint, Organization structure, Well-Architected Framework, Foster a culture of cost awareness, Labels overview)
Identity and access¶
- 9
GCP-3Don't grant basic roles, such as Owner, Editor and Viewer, in production. Grant predefined or custom roles to groups, at the smallest scope that works. Basic roles include thousands of permissions across all services. (Use IAM securely: least privilege, Roles overview: basic roles) - 8
GCP-4Don't use service account keys: attach service accounts to workloads that run on Google Cloud, use Workload Identity Federation for CI pipelines and workloads elsewhere, and block key creation with an organization policy. When you federate with GitHub or another multi-tenant identity provider, restrict the provider with an attribute condition (seeGHA-5in GitHub Actions). (Best practices for service accounts: use keys only when there is no alternative, Workload Identity Federation with deployment pipelines, Best practices for Workload Identity Federation: attribute conditions) - 8
GCP-5Give each application its own single-purpose service account instead of a default service account, and grant users the Service Account User and Token Creator roles on individual service accounts, not on projects or folders. Default service accounts may hold the Editor role on their project. (Best practices for service accounts: single-purpose service accounts, project and folder grants)
Guardrails¶
- 8
GCP-6Enforce the Google Cloud security baseline constraints in every organization, including organizations created before 3 May 2024, which may not have them. They disable service account key creation and upload, stop default service accounts from getting the Editor role, restrict sharing to your own domains and require uniform bucket-level access. (Manage Google Cloud security baseline constraints) - 6
GCP-7Add further Organization Policy constraints at the organization or folder level, starting from the enterprise foundations blueprint's set, and test each new policy in dry-run mode before you enforce it. (Organization Policy overview, Enterprise foundations blueprint, Preventative controls)
Data protection¶
- 7
GCP-8Keep secrets in Secret Manager, grant access per secret when one project holds secrets for many services, and reference secret versions by number instead oflatest. (Secret Manager best practices) - 5
GCP-9Put projects that hold sensitive data, for example in Cloud Storage or BigQuery, inside VPC Service Controls perimeters in addition to IAM, and run each new perimeter in dry-run mode first. Careless enablement can break applications. (Overview of VPC Service Controls, Best practices for enabling VPC Service Controls)
Reliability¶
- 8
GCP-10Deploy production workloads across multiple zones, and across regions where your availability or recovery targets require it. A zonal resource, such as a Compute Engine VM, is affected when its zone has an outage. (Compute Engine, Regions and zones, Well-Architected Framework, Build highly available systems through resource redundancy, Google Cloud deployment archetypes)
Delivery and operations¶
- 8
GCP-11Manage the organization's foundation and all workloads as code with Terraform, applied from a pipeline that validates changes against your policies, as the enterprise foundations blueprint does. (Well-Architected Framework, Automate and manage change, Enterprise foundations blueprint, Deployment methodology, Terraform blueprints and modules for Google Cloud) - 7
GCP-12Route audit logs from the whole organization to a central project with an aggregated sink, and turn on Data Access audit logs for services that handle sensitive data. Except for BigQuery, Data Access audit logs are off by default. (Cloud Logging, Aggregated sinks, Cloud Audit Logs overview, Enterprise foundations blueprint, Detective controls) - 7
GCP-13Create Cloud Billing budgets with alert thresholds for each billing account or project, and send the alerts to the owners or to Pub/Sub for automated responses. An alerts-only budget doesn't cap spending. (Cloud Billing, Create, edit, or delete budgets and budget alerts)
How to enforce¶
Tools that check the key rules above automatically, in CI, the IDE or a commit hook. "Partly" means the tool covers only some of what the rule asks.
- 7 Organization Policy constraints: the Organization Policy service enforces them, so resource configurations that break them can't be created. The baseline constraints include
iam.managed.disableServiceAccountKeyCreation,iam.disableServiceAccountKeyUpload,iam.automaticIamGrantsForDefaultServiceAccounts,iam.allowedPolicyMemberDomainsandstorage.uniformBucketLevelAccess. ChecksGCP-6, and partlyGCP-4. - 6 Security Command Center, Compliance Manager cloud controls: continuous detective controls, which replace Security Health Analytics for new activations, such as Restrict Legacy IAM Roles, Restrict User Managed Service Account Keys, Block Service Account Key Creation, Use Custom Service Accounts for Compute Engine Instances, Define Service Perimeters in VPC Service Controls and Enable Audit Logs for All Services. All except Restrict User Managed Service Account Keys need the Premium tier. Partly checks
GCP-3,GCP-4,GCP-5,GCP-6,GCP-9andGCP-12. - 6 IAM role recommendations (Policy Intelligence): compare each principal's permissions with what it used in the last 90 days, and recommend removing or replacing roles, for example to replace basic roles. Partly checks
GCP-3. - 6 Checkov Terraform policies: misconfiguration checks before deployment, including basic roles at organization, folder and project level (
CKV_GCP_115toCKV_GCP_117), user-managed service account keys (CKV2_GCP_3), VMs using the default service account (CKV_GCP_30), project-level Service Account User or Token Creator grants (CKV_GCP_41) and audit logging for all services (CKV2_GCP_5). Partly checksGCP-3,GCP-4,GCP-5andGCP-12.
Tutorials and further reading¶
- 5 Professional Cloud Architect learning path (Google Skills): courses, labs and skill badges on designing, building and managing solutions on Google Cloud.
- 5 Cloud Foundation Fabric: Terraform modules and FAST, a landing zone toolkit, meant to be forked and customized. An alternative to the Cloud Foundation Toolkit (CFT) modules that the example foundation is built from.