Architecture pattern library

AWS field guide

Measure unit cost before optimizing spend

Measure cost per useful outcome so architecture decisions can distinguish growth from waste.

Use this pattern when

Usage is growing, a new managed service is being adopted, or cost varies sharply with traffic.

Reference architecture

Responsibilities and controls, not a deployment template.

Synchronous Asynchronous

Workload usage

Requests, jobs, or tenants

Allocation tags

Ownership and environment

AWS Cost Explorer

Cost and usage evidence

Unit-cost metric

Spend per useful outcome

AWS Budgets

Threshold and anomaly action

AWS service marks use the official Q3 2026 AWS Architecture Icons. Abstract nodes represent application responsibilities rather than AWS services.

Decisions that shape the pattern

  • Pick one meaningful business unit.
  • Tag resources at creation.
  • Separate fixed, variable, and transfer costs.

Security boundaries

  • Limit access to billing details.
  • Protect budget notification targets.
  • Audit changes to cost controls.

Reliability posture

  • Use alerts before hard limits where shutdown is risky.
  • Account for retry and failure cost.
  • Review anomalies with workload context.

Starter implementation

Start from deployable infrastructure

Review every permission, limit, Region, and cost assumption before production.

Download ADR template
cost-guardrails.stack.ts
import { Duration, Stack, StackProps } from 'aws-cdk-lib';
import * as apigateway from 'aws-cdk-lib/aws-apigateway';
import * as athena from 'aws-cdk-lib/aws-athena';
import * as bedrock from 'aws-cdk-lib/aws-bedrock';
import * as budgets from 'aws-cdk-lib/aws-budgets';
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
import * as origins from 'aws-cdk-lib/aws-cloudfront-origins';
import * as cloudtrail from 'aws-cdk-lib/aws-cloudtrail';
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as ecs from 'aws-cdk-lib/aws-ecs';
import * as patterns from 'aws-cdk-lib/aws-ecs-patterns';
import * as events from 'aws-cdk-lib/aws-events';
import * as targets from 'aws-cdk-lib/aws-events-targets';
import * as glue from 'aws-cdk-lib/aws-glue';
import * as iam from 'aws-cdk-lib/aws-iam';
import * as kms from 'aws-cdk-lib/aws-kms';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as sources from 'aws-cdk-lib/aws-lambda-event-sources';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
import * as sqs from 'aws-cdk-lib/aws-sqs';
import { Construct } from 'constructs';

export class PatternStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    new budgets.CfnBudget(this, 'MonthlyBudget', {
      budget: {
        budgetName: 'workload-monthly', budgetType: 'COST', timeUnit: 'MONTHLY',
        budgetLimit: { amount: 100, unit: 'USD' },
        costFilters: { TagKeyValue: ['user:workload$example'] },
      },
      notificationsWithSubscribers: [{
        notification: { comparisonOperator: 'GREATER_THAN', notificationType: 'FORECASTED', threshold: 80, thresholdType: 'PERCENTAGE' },
        subscribers: [{ address: 'owner@example.com', subscriptionType: 'EMAIL' }],
      }],
    });
  }
}

Before production

Adoption checklist

  1. 01Define a unit of value.
  2. 02Enforce allocation tags.
  3. 03Create monthly and anomaly budgets.
  4. 04Review top variable drivers.
  5. 05Record cost impact in architecture decisions.

From the journal

Selected from service names and architecture signals used by this pattern.

Was this playbook useful?

One click helps prioritize deeper examples and updates.