Platform Engineering · Lesson 156

The Google Cloud Well-Architected Framework: Six Pillars and the AI Perspective

The Google Cloud Well-Architected Framework (called the Architecture Framework until 2024) has six pillars: operational excellence; security, privacy, and compliance; reliability; cost optimization; performance optimization; and sustainability. Each pillar is a set of principles with recommendations, and cross-pillar perspectives apply them to one kind of workload, such as AI and ML. There is no separate review tool; you review against the recommendations and use Active Assist (Recommender) and Carbon Footprint for evidence. This lesson reviews one analytics and ML service, and shows two misses: a regional design that called itself highly available, and a training pipeline placed without a thought for cost or carbon.

Difficulty: Advanced · Know this first: Lesson 155, Lesson 146

What you will learn

By the end of this lesson you can work at four levels:

This page teaches it with a plain-language analogy, an animated diagram with normal and failure scenarios, a simulator, a quiz, basic, intermediate, advanced, and master checks, the expert detail ("Go deeper"), a production incident, a hands-on lab with commands and their output, and a production design exercise.

Run it as:

When it breaks, I check

One thing to remember

Where the time goes

This bar adds up hours of review work for one service. It is a worked example, not a measurement. The reliability and cost hops are where the diagram and the bill disagree with reality.

Try it: place the training and serving

Pick where training runs, on what capacity, and how serving is deployed. The readouts show the cost and emissions of a month of nightly training, and what a zone loss does.

$9.8ktraining a month
0.4 tCO₂e a month
serves onzone loss

Check yourself

Three questions. No score is saved anywhere — this is just you against the material.

Basic to master

Using the Google Cloud framework grows in four levels: knowing the pillars, reviewing against the recommendations, using the evidence tools, and building the pillars into the organisation.

Basic — Know the six pillars

At the basic level you can name the pillars and the perspectives.

  • Operational excellence; security, privacy, and compliance; reliability; cost optimization; performance optimization; sustainability.
  • Principles and recommendations per pillar; perspectives such as AI and ML.
  • Zonal, regional, and multi-region resources.

Where it breaks: calling a design regional because its Region is named in the diagram.

Try it: Basic

A GKE cluster's location is europe-west4-a. Is it zonal or regional?

Now do it: List your clusters and their locations.

Intermediate — Review against the recommendations

At the intermediate level you review a workload pillar by pillar, with its perspective.

  • Read each pillar's principles and recommendations; answer with evidence from the project.
  • Apply the perspective that fits (AI and ML, financial services).
  • Record decisions and open recommendations with owners.

Try it: Intermediate

There is no review tool. How do you make a review repeatable?

Now do it: Write a one-page template for one pillar.

Advanced — Use the evidence tools

At the advanced level the review uses data, not opinions.

  • Active Assist recommendations and insights by pillar; IAM recommender for least privilege.
  • Carbon Footprint exported to BigQuery next to billing data.
  • Cloud Monitoring SLOs on user outcomes.

Try it: Advanced

How do you compare cost and emissions per service over time?

Now do it: Enable both exports in a sandbox project.

Master — Build the pillars into the organisation

At the master level the framework is encoded in the foundation every project starts from.

  • The resource hierarchy, Organization Policy constraints, and a project factory that applies them.
  • Regional by default for production; allowed Regions chosen with carbon and data residency in mind.
  • Recommendations reviewed monthly per team; SLOs, cost, and carbon reported together.

Trade-off: regional and multi-region defaults cost more than zonal; make zonal an explicit, recorded exception for non-critical work.

Try it: Master

How do you stop new production projects from creating resources in disallowed Regions?

Now do it: Set the constraint on a test folder.

Go deeper

Evidence for a review, read-only:

# zonal or regional? (a zone in LOCATION means zonal)
gcloud container clusters list --format="table(name,location,currentNodeCount)"
gcloud sql instances list --format="table(name,region,settings.availabilityType)"   # ZONAL or REGIONAL
# service account keys that should not exist
gcloud iam service-accounts list --format="value(email)" | while read sa; do
  gcloud iam service-accounts keys list --iam-account="$sa" --managed-by=user --format="value(name)"; done
# Active Assist: rightsizing and idle resources
gcloud recommender recommendations list --project="$P" --location="$ZONE" \
  --recommender=google.compute.instance.MachineTypeRecommender --format="table(description,primaryImpact.category)"
gcloud recommender recommendations list --project="$P" --location=global \
  --recommender=google.iam.policy.Recommender --format="table(description)"

The pillars' principles, as Google Cloud lists them (the wording is revised over time; read the current pages before a review):

How the three clouds' frameworks line up:

AWSAzureGoogle Cloud
FrameworkAWS Well-Architected FrameworkAzure Well-Architected FrameworkGoogle Cloud Well-Architected Framework (called the Architecture Framework until 2024)
PillarsSix: operational excellence, security, reliability, performance efficiency, cost optimization, sustainabilityFive: reliability, security, cost optimization, operational excellence, performance efficiency; sustainability is separate guidanceSix: operational excellence; security, privacy, and compliance; reliability; cost optimization; performance optimization; sustainability
Inside each pillarDesign principles, best practices, and review questionsDesign principles, a checklist, recommendations, and trade-offs with the other pillarsPrinciples and recommendations
Specialised guidanceLenses (for example serverless, SaaS, machine learning, generative AI)Workload guidance (for example AI, mission-critical, SaaS) and service guides per Azure servicePerspectives (for example AI and ML, financial services)
Review toolAWS Well-Architected Tool: questions per pillar, high- and medium-risk issues, milestones, an APIAzure Well-Architected Review, an assessment in Microsoft Assessments, with a score and recommendations per pillarNo separate review tool; the framework's recommendations, Architecture Center, and Active Assist
Automated recommendationsTrusted Advisor (the number of checks depends on the support plan), Compute OptimizerAzure Advisor, grouped by reliability, security, performance, cost, and operational excellence, with an Advisor scoreActive Assist: Recommender (rightsizing, idle resources, IAM) and insights
Carbon dataCustomer Carbon Footprint ToolEmissions Impact Dashboard; carbon optimization in the portalCarbon Footprint, with export to BigQuery; low-carbon indicators per region
Policy and guardrailsOrganizations service control policies, AWS Config rules and conformance packsAzure Policy, initiatives, management groupsOrganization Policy, constraints, folders
Landing zone guidanceAWS Control Tower, the Landing Zone AcceleratorCloud Adoption Framework Azure landing zonesGoogle Cloud setup checklist and enterprise foundations blueprint

Where they differ, not just in names: Azure keeps sustainability out of its five pillars and in separate guidance; Google Cloud folds privacy and compliance into its security pillar; AWS has the most formal review process (questions, risk levels, milestones) in its own tool. The ideas line up closely; the services and the detail do not, so review a workload against the framework of the cloud it runs on, and use the others for ideas.

One time it broke

This is a composite of a failure pattern that keeps repeating; the details are illustrative. Regional on paper.

Timeline

  • DesignThe design document says "regional GKE, HA Cloud SQL". To unblock a demo, the cluster is created in europe-west4-a and the database without high availability, "to be fixed before launch".
  • Launch + 2 months, 22:00A disruption in europe-west4-a. Serving stops; the nightly publication job cannot reach its database.
  • 05:00Forecasts are not published. Stores fall back to yesterday's forecast; about 300 order the wrong quantities of fresh food.
  • Next weekThe cluster and database are rebuilt as regional; the review template now checks deployed locations, not the design document.

What changed after

Production folders have an Organization Policy and a project-factory check that refuse zonal clusters and non-HA databases without a recorded exception, the review compares the design with gcloud output, and the late-forecast SLO pages before 05:00.

Try it yourself, from scratch

Everything here runs on any Linux machine: your own laptop, WSL on Windows (run wsl --install in PowerShell once), or a small cloud VM. The Python needs only Python 3 and its standard library; check that you have it with python3 --version.

Before you start: The gcloud CLI logged in with Viewer on a project (gcloud config get-value project should print it), and the Recommender API enabled.

1. Linux commands

Type each one, read what it prints, and compare it with the note above it.

  1. Check whether clusters are zonal or regional (a zone in LOCATION means zonal).

    gcloud container clusters list --format="table(name,location,currentNodeCount)"

    Expect: europe-west4-a is zonal; europe-west4 is regional. Read-only: it lists or describes, and changes nothing.

  2. Check Cloud SQL availability type: ZONAL or REGIONAL.

    gcloud sql instances list --format="table(name,region,settings.availabilityType)"

    Expect: REGIONAL means a standby in another zone. Read-only: it lists or describes, and changes nothing.

  3. Ask Active Assist for rightsizing recommendations in one zone.

    gcloud recommender recommendations list --project="$(gcloud config get-value project)" --location=europe-west4-a \
      --recommender=google.compute.instance.MachineTypeRecommender --format="table(description,primaryImpact.category)"

    Options: --recommender picks the kind of recommendation; others include idle VMs and the IAM policy recommender (location global).

    Expect: Machine types to shrink, or nothing if instances fit their use. Read-only: it lists or describes, and changes nothing.

  4. List user-managed service account keys, which the security pillar says to avoid.

    for sa in $(gcloud iam service-accounts list --format="value(email)"); do
      gcloud iam service-accounts keys list --iam-account="$sa" --managed-by=user --format="value(name.basename(),validAfterTime)" | sed "s|^|$sa |"
    done

    Expect: Each key with its creation time; the goal is none, using Workload Identity instead. Read-only: it lists or describes, and changes nothing.

2. Python: placement.py

This program places a nightly training job. For each candidate Region it adds up GPU-hours (more when data must be copied from another continent), cost on on-demand and Spot capacity, egress, and emissions from the Region's carbon intensity. The figures are illustrative; use Carbon Footprint and your billing export for real ones. Save it as placement.py, then run it.

# placement.py
NIGHTLY_GPU_HOURS = 12            # with the data in the same Region
REGIONS = {                       # (data local?, grams CO2e per kWh, on-demand $/GPU-h, spot $/GPU-h)
    "europe-west4 (with the data)": (True, 280, 3.7, 1.2),
    "europe-north1 (with the data)": (True, 40, 3.7, 1.2),
    "us-central1 (data in the EU)": (False, 420, 3.4, 1.1),
}
KW_PER_GPU, EGRESS_PER_NIGHT, NIGHTS = 0.7, 80.0, 30

print(f"{'Region':<31} {'GPU-h':>6} {'on-demand':>10} {'spot':>8} {'egress':>7} {'kg CO2e':>8}")
best = None
for name, (local, grams, od, spot) in REGIONS.items():
    hours = NIGHTLY_GPU_HOURS * (1 if local else 2.5) * NIGHTS     # GPUs wait on copied data
    egress = 0 if local else EGRESS_PER_NIGHT * NIGHTS
    kg = hours * KW_PER_GPU * grams / 1000
    monthly_spot = hours * spot + egress
    print(f"{name:<31} {hours:6.0f} {hours * od + egress:10.0f} {monthly_spot:8.0f} {egress:7.0f} {kg:8.1f}")
    if local and (best is None or kg < best[1]):
        best = (name, kg, monthly_spot)
print()
print(f"place training in {best[0]}: about {best[2]:.0f} dollars a month on Spot and {best[1]:.0f} kg CO2e,")
print("with the data, so no egress and no idle GPUs waiting for a copy.")

Run it, and you should see this output:

$ python3 placement.py
Region                           GPU-h  on-demand     spot  egress  kg CO2e
europe-west4 (with the data)       360       1332      432       0     70.6
europe-north1 (with the data)      360       1332      432       0     10.1
us-central1 (data in the EU)       900       5460     3390    2400    264.6

place training in europe-north1 (with the data): about 432 dollars a month on Spot and 10 kg CO2e,
with the data, so no egress and no idle GPUs waiting for a copy.

3. What to notice

4. Advanced: every step as one Bash script

The same Linux steps, made into a real script you can keep and run again. It uses the Bash features a production script needs: functions (one per step), an array of step names, arguments to choose steps, a case for options, exit codes recorded for each step, and a trap that prints a summary even when you stop it with Ctrl+C. Make a folder for this lesson (mkdir -p ~/labs/google-cloud-well-architected-framework && cd ~/labs/google-cloud-well-architected-framework) and save this as lab.sh.

#!/usr/bin/env bash
# The Linux steps of "The Google Cloud Well-Architected Framework: Six Pillars and the AI Perspective", as one script (save it as lab.sh).
#
#   ./lab.sh          run every step, in order
#   ./lab.sh 2 4      run only steps 2 and 4
#   ./lab.sh --list   list the steps
#
# The steps share one shell, so a later step can use what an earlier one set up (a folder,
# a variable, a container): run them all in order the first time. Your own scripts should
# start with "set -euo pipefail"; this one runs teaching commands, and some of them fail on
# purpose, so it records each step's exit code instead of stopping at the first failure.

STEPS=(
  'Check whether clusters are zonal or regional (a zone in LOCATION means zonal).'
  'Check Cloud SQL availability type: ZONAL or REGIONAL.'
  'Ask Active Assist for rightsizing recommendations in one zone.'
  'List user-managed service account keys, which the security pillar says to avoid.'
)

step_1() {
gcloud container clusters list --format="table(name,location,currentNodeCount)"
}

step_2() {
gcloud sql instances list --format="table(name,region,settings.availabilityType)"
}

step_3() {
gcloud recommender recommendations list --project="$(gcloud config get-value project)" --location=europe-west4-a \
  --recommender=google.compute.instance.MachineTypeRecommender --format="table(description,primaryImpact.category)"
}

step_4() {
for sa in $(gcloud iam service-accounts list --format="value(email)"); do
  gcloud iam service-accounts keys list --iam-account="$sa" --managed-by=user --format="value(name.basename(),validAfterTime)" | sed "s|^|$sa |"
done
}

# print a step that has to be run by hand, instead of running it
by_hand() {
  echo "  (run this one yourself: $1)"
  sed 's/^/    /'
}

RESULTS=()
run_step() {
  local n=$1 start=$SECONDS code
  printf '\n== step %d of %d: %s\n' "$n" "${#STEPS[@]}" "${STEPS[n-1]}"
  "step_$n"
  code=$?
  RESULTS+=("step $n: exit code $code, $((SECONDS - start)) s")
}

summary() {
  echo
  echo "== summary"
  local r
  for r in "${RESULTS[@]}"; do echo "  $r"; done
}

case "${1:-}" in
  -h|--help) sed -n '2,6p' "$0"; exit 0 ;;
  --list) for i in "${!STEPS[@]}"; do echo "$((i + 1)). ${STEPS[i]}"; done; exit 0 ;;
esac

[ $# -eq 0 ] && set -- $(seq 1 "${#STEPS[@]}")
for n in "$@"; do
  if ! [[ $n =~ ^[0-9]+$ ]] || (( n < 1 || n > ${#STEPS[@]} )); then
    echo "there is no step '$n'; try --list" >&2
    exit 2
  fi
done
trap summary EXIT
trap 'echo; echo "stopped with Ctrl+C"; exit 130' INT
for n in "$@"; do run_step "$n"; done

Then make it executable and run it:

chmod +x lab.sh
./lab.sh --list     # the steps
./lab.sh            # every step, then a summary of exit codes and times
./lab.sh 2 3        # only steps 2 and 3

5. Learn the basics behind it

New to a feature used above? These W3Schools pages explain each one from zero, with examples you can run in the browser.

If you remember nothing else

Design exercise

A retailer runs 15 analytics and ML services on Google Cloud. Design how the Well-Architected Framework is applied, including the AI and ML perspective.

Clarifying questions to ask

What goes into the organisation's foundation as policy? What does the review template ask, per pillar? Which evidence tools feed it? How are training and serving placed for cost, carbon, and data residency? How are reliability claims verified?

Rough sizing

Say 15 services, 6 with nightly training on GPUs, serving in two EU Regions, data residency in the EU, and a 3× overspend last quarter.

Shape of the answer

A resource hierarchy with production folders under Organization Policy (allowed EU Regions, no service account keys, no external IPs); a project factory that creates regional GKE and HA databases by default; a review template per pillar plus the AI and ML perspective, answered with gcloud evidence; Active Assist and the IAM recommender reviewed monthly; billing and Carbon Footprint exported to BigQuery and reported per service; training placed with its data in the lowest-carbon allowed Region on Spot with checkpoints; SLOs on publication deadlines.

Trade-offs to name

Regional defaults cost more and remove a whole class of outage; Spot training saves most and needs checkpointing work; restricting Regions for residency and carbon can limit GPU availability, so keep a second allowed Region.

Failure modes and how to troubleshoot them

Each row is one way this system went wrong in the diagram's scenarios. The hop number is where to look first.

ScenarioWhereEffectWhat goes wrong
Zonal pretending to be regionalHop 4: ReliabilityBreaksThe design document says "highly available, regional". The GKE cluster was created as zonal in europe-west4-a to save time, and Cloud SQL as zonal. A zone disruption at 22:00 stops serving and the nightly publication.
Cost and carbon ignoredHop 5: Cost optimizationBreaksCost is left for later. Training runs nightly on on-demand A100s in a Region chosen because quota was available, while the data sits in another continent and is copied every night; the input pipeline is slow, so GPUs wait 60% of each run.
Cost and carbon ignoredHop 6: Performance optimizationDegradesGPUs idle 60% of each run, waiting for data copied across continents.

How to troubleshoot

  1. Write down the symptom and when it started: what users see, which number moved, and what changed just before (a deploy, a config change, traffic).
  2. Walk the path in order, from the first hop to the last: Workload → Operational excellence → Security, privacy, compliance → Reliability → Cost optimization → Performance optimization → Sustainability → AI and ML perspective → Active Assist. The first hop whose evidence is wrong is where to dig.
  3. At that hop, run the read-only check from the diagram or the lab first; change nothing until the evidence points at a cause.
  4. Fix the smallest thing that restores service, or roll back the last change, and confirm the symptom is gone with the same check.
  5. Write down what you found and the check that would have caught it sooner, so the next person starts there.

Architecture review checklist

Review the design in this lesson, or your own, against these ten areas. Tick an area when you can answer its question with evidence: a number, a test, a document, or an owner. Your ticks stay in this browser.

  1. Business outcomeWhich result for users or the business does this design serve, and which number shows it is working?
  2. SecurityWho and what can reach each part, how is identity proven, and how is data protected in transit and at rest?
  3. ReliabilityWhat is the target (SLO), which single failures does the design survive, and how was that tested?
  4. PerformanceWhat latency and throughput are required at peak, and where is the first bottleneck?
  5. OperationsHow is it deployed, observed, and changed safely, and who is paged when it breaks?
  6. CostWhat does it cost per month and per unit of work (request, tenant, model call), and what grows the bill?
  7. SustainabilityWhich resources sit idle, which region and hardware does it run on, and what can scale to zero?
  8. GovernanceWhich policies, guardrails, and compliance rules apply, and how are they enforced in code?
  9. OwnershipWhich team owns each component, its budget, and its on-call, and where is that written down?
  10. Failure and recovery planWhat is the RTO and RPO, what is the runbook for a region or dependency loss, and when was it last rehearsed?

References and review

The official documentation and standards behind this lesson. Versions and defaults change; when a command or field here differs from them, trust the official page.

Last updated . Next review due by November 2027. Found something out of date? Tell me.

Saved on this device, in this browser.
Next in this series · Lesson 157
Landing Zones: Account Hierarchy, Identity Federation, and Guardrails

A landing zone is the prepared ground every cloud workload lands on: a hierarchy of accounts (AWS), subscriptions (Azure), or projects (Google Cloud) grouped under organisational units, management groups, or folders; people…

Go to Lesson 157 →

Or browse the full course from the Lessons index.