Architecture reviews without structure tend to become conversations where experienced engineers share opinions and junior engineers take notes. The AWS Well-Architected Framework gives structure to these reviews by providing a set of questions across five pillars that surface specific architectural risks. The Well-Architected Tool makes those reviews actionable with HRI scoring, improvement plan tracking, and milestone snapshots.
In this article I will walk through conducting an effective Well-Architected review, interpreting findings, using the Tool API to run reviews programmatically across many workloads, and building custom lenses for organization-specific standards that the default pillars do not cover.
Creating a Workload
resource "aws_wellarchitected_workload" "production_api" {
name = "Production Order API"
description = "Customer-facing order management API and associated infrastructure"
environment = "PRODUCTION"
review_owner = "platform-team@yourcompany.com"
industry_type = "Internet"
industry = "Retail"
non_aws_regions = []
aws_regions = ["us-east-1", "eu-west-1"]
lenses = [
"wellarchitected",
"serverless"
]
tags = {
Team = "platform"
Environment = "production"
ManagedBy = "terraform"
}
}
Including the serverless lens alongside the standard Well-Architected lens adds serverless-specific questions about event-driven architecture, function execution environments, and event source mapping that the base lens does not cover. Use additional lenses whenever your workload has a significant component that a specialized lens addresses. AWS publishes lenses for serverless, SaaS, streaming media, financial services, and several other domains.
Answering Questions Programmatically
The Tool API lets you answer review questions and update answers without using the console. This is useful for running reviews programmatically, for pre-populating answers based on your Terraform state, or for building review automation that answers known-good questions based on automated infrastructure checks.
import boto3
wa = boto3.client("wellarchitected", region_name="us-east-1")
def list_questions(workload_id: str, lens_alias: str, pillar: str) -> list:
response = wa.list_answers(
WorkloadId = workload_id,
LensAlias = lens_alias,
PillarId = pillar
)
return response["AnswerSummaries"]
def update_answer(workload_id: str, lens_alias: str, question_id: str, choice_ids: list, notes: str = ""):
wa.update_answer(
WorkloadId = workload_id,
LensAlias = lens_alias,
QuestionId = question_id,
SelectedChoices = choice_ids,
Notes = notes,
IsApplicable = True
)
def get_lens_review_summary(workload_id: str, lens_alias: str) -> dict:
response = wa.get_lens_review(
WorkloadId = workload_id,
LensAlias = lens_alias
)
review = response["LensReview"]
return {
"risk_counts": review["RiskCounts"],
"pillars": [
{
"pillar": p["PillarName"],
"hri_count": p["RiskCounts"].get("HIGH", 0),
"mri_count": p["RiskCounts"].get("MEDIUM", 0)
}
for p in review["PillarReviewSummaries"]
]
}
summary = get_lens_review_summary(
workload_id = "abc12345-...",
lens_alias = "wellarchitected"
)
print(f"Total HRIs: {summary['risk_counts'].get('HIGH', 0)}")
Custom Lenses for Organization-Specific Standards
Custom lenses let you add questions that reflect your organization’s specific architecture standards, internal compliance requirements, or domain-specific best practices. Teams answer custom lens questions the same way as standard pillar questions, and findings appear in the same improvement plan.
resource "aws_wellarchitected_lens" "internal_standards" {
lens_version = "1.0"
name = "Company Internal Standards"
description = "Organization-specific architecture and security standards"
tags = { ManagedBy = "terraform" }
json_string = jsonencode({
schemaVersion = "2021-11-01"
name = "Company Internal Standards"
description = "Organization-specific architecture standards"
pillars = [
{
id = "INTERNAL_SECURITY"
name = "Internal Security Standards"
questions = [
{
id = "SEC01"
title = "Secrets Management"
description = "How are secrets and credentials managed in this workload?"
choices = [
{
id = "SEC01_A1"
title = "All secrets stored in AWS Secrets Manager"
description = "No plaintext secrets in code, environment variables, or configuration files"
},
{
id = "SEC01_A2"
title = "Automatic rotation enabled for database credentials"
description = "Database passwords rotate on a schedule with no application downtime"
},
{
id = "SEC01_A3"
title = "Secret access is logged and auditable"
description = "CloudTrail captures all GetSecretValue calls for compliance review"
}
]
riskRules = [
{
condition = "SEC01_A1 && SEC01_A2 && SEC01_A3"
risk = "NONE"
},
{
condition = "SEC01_A1"
risk = "MEDIUM"
},
{
condition = "default"
risk = "HIGH"
}
]
}
]
}
]
})
}
The riskRules section defines how the Tool calculates the HRI or MRI status for each question based on which choices are selected. Workloads that have all three secrets management choices selected have no risk. Workloads with only the first choice selected are medium risk. Workloads with none selected are high risk. This logic mirrors exactly how the standard lens questions work, giving your custom standards the same scorable, trackable status as the built-in pillar questions.
Milestone Tracking
def create_milestone(workload_id: str, milestone_name: str):
response = wa.create_milestone(
WorkloadId = workload_id,
MilestoneName = milestone_name
)
return response["MilestoneNumber"]
def compare_milestones(workload_id: str, lens_alias: str, milestone_1: int, milestone_2: int):
m1 = wa.get_lens_review(
WorkloadId = workload_id,
LensAlias = lens_alias,
MilestoneNumber = milestone_1
)["LensReview"]["RiskCounts"]
m2 = wa.get_lens_review(
WorkloadId = workload_id,
LensAlias = lens_alias,
MilestoneNumber = milestone_2
)["LensReview"]["RiskCounts"]
return {
"hri_change": m2.get("HIGH", 0) - m1.get("HIGH", 0),
"mri_change": m2.get("MEDIUM", 0) - m1.get("MEDIUM", 0),
"improving": m2.get("HIGH", 0) < m1.get("HIGH", 0)
}
create_milestone(workload_id="abc123", milestone_name="Q3 2026 Review")
Milestones snapshot the current state of the review. Create one before starting remediation work and another after completing it. The comparison shows exactly how many HRIs and MRIs were resolved between reviews. This gives engineering leaders and security teams a quantitative measure of architecture improvement over time rather than a qualitative description of what changed.
Closing Thoughts
The Well-Architected Tool is most valuable when you treat reviews as a recurring practice rather than a one-time event. Create milestones before and after each remediation cycle so you can measure progress. Use the API to run reviews programmatically across all your workloads on a regular schedule. Build custom lenses for your organization-specific standards so they get the same rigor as the five built-in pillars.
Start with your most critical production workloads. Answer all questions honestly, including the ones that reveal gaps. Prioritize HRI findings over MRIs. Create a milestone, remediate the highest-risk findings, create another milestone, and compare. The framework works best as a discipline rather than as a checkbox exercise done once before an audit.
Enjoy the cloud.
Osama
#AWS #WellArchitected #CloudArchitecture #CloudGovernance #Terraform #InfrastructureAsCode #AmazonWebServices #SolutionsArchitect #CloudComputing #ArchitectureReview #CloudCompliance #SRE #TechBlog #CloudInfrastructure #SecurityEngineering #CostOptimization #Reliability #Pillar #DevOps #Engineering
Leave a Reply