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
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.
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.
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.
Three questions. No score is saved anywhere — this is just you against the material.
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.
At the basic level you can name the pillars and the perspectives.
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.
At the intermediate level you review a workload pillar by pillar, with its perspective.
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.
At the advanced level the review uses data, not opinions.
Try it: Advanced
How do you compare cost and emissions per service over time?
Now do it: Enable both exports in a sandbox project.
At the master level the framework is encoded in the foundation every project starts from.
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.
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:
| AWS | Azure | Google Cloud | |
|---|---|---|---|
| Framework | AWS Well-Architected Framework | Azure Well-Architected Framework | Google Cloud Well-Architected Framework (called the Architecture Framework until 2024) |
| Pillars | Six: operational excellence, security, reliability, performance efficiency, cost optimization, sustainability | Five: reliability, security, cost optimization, operational excellence, performance efficiency; sustainability is separate guidance | Six: operational excellence; security, privacy, and compliance; reliability; cost optimization; performance optimization; sustainability |
| Inside each pillar | Design principles, best practices, and review questions | Design principles, a checklist, recommendations, and trade-offs with the other pillars | Principles and recommendations |
| Specialised guidance | Lenses (for example serverless, SaaS, machine learning, generative AI) | Workload guidance (for example AI, mission-critical, SaaS) and service guides per Azure service | Perspectives (for example AI and ML, financial services) |
| Review tool | AWS Well-Architected Tool: questions per pillar, high- and medium-risk issues, milestones, an API | Azure Well-Architected Review, an assessment in Microsoft Assessments, with a score and recommendations per pillar | No separate review tool; the framework's recommendations, Architecture Center, and Active Assist |
| Automated recommendations | Trusted Advisor (the number of checks depends on the support plan), Compute Optimizer | Azure Advisor, grouped by reliability, security, performance, cost, and operational excellence, with an Advisor score | Active Assist: Recommender (rightsizing, idle resources, IAM) and insights |
| Carbon data | Customer Carbon Footprint Tool | Emissions Impact Dashboard; carbon optimization in the portal | Carbon Footprint, with export to BigQuery; low-carbon indicators per region |
| Policy and guardrails | Organizations service control policies, AWS Config rules and conformance packs | Azure Policy, initiatives, management groups | Organization Policy, constraints, folders |
| Landing zone guidance | AWS Control Tower, the Landing Zone Accelerator | Cloud Adoption Framework Azure landing zones | Google 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.
This is a composite of a failure pattern that keeps repeating; the details are illustrative. Regional on paper.
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.
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.
Type each one, read what it prints, and compare it with the note above it.
Check whether clusters are zonal or regional (a zone in LOCATION means zonal).
gcloud container clusters list --format="table(name,location,currentNodeCount)"
Check Cloud SQL availability type: ZONAL or REGIONAL.
gcloud sql instances list --format="table(name,region,settings.availabilityType)"
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)"
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
placement.pyThis 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.
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
New to a feature used above? These W3Schools pages explain each one from zero, with examples you can run in the browser.
sed, Pipes, Loops.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.
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?
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.
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.
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.
Each row is one way this system went wrong in the diagram's scenarios. The hop number is where to look first.
| Scenario | Where | Effect | What goes wrong |
|---|---|---|---|
| Zonal pretending to be regional | Hop 4: Reliability | Breaks | The 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 ignored | Hop 5: Cost optimization | Breaks | Cost 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 ignored | Hop 6: Performance optimization | Degrades | GPUs idle 60% of each run, waiting for data copied across continents. |
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.
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.