Elasticity and right-sizing

You pay for what you provision, so make it follow demand

00:0006:0012:0018:0024:002410instances runningauto scaling: 387 instance-hourssized for the peak: 576 instance-hours33% of the fixed fleet’s hourspay for nothing189 idle hours × $0.1008 = $19.05 a dayabout $6,954 a year, for one small serviceIn the cloud you pay for what you provision, not what you use: make capacity follow demand.A fleet sized for the afternoon peak sits mostly idle at night. Auto scaling adds and removes servers with the load,serverless and managed services bill per request, and right-sizing (AWS Compute Optimizer reads the metrics) movesoversized servers to smaller types. Switch off what nobody uses: test environments at night and at weekends.

A fleet sized for the peak runs 576 instance-hours a day; auto scaling needs 387. 33% of the fixed hours are idle.

Data transfer · Going deeper

Bytes come in free and pay to leave or cross a boundary

What a gigabyte costs to movein from the internetfreesame zone, private addressesfreeAWS origin to CloudFrontfreebetween zones in a Region$0.01 each waybetween Regions$0.02through a NAT gateway+ $0.045out to the internet$0.09One month of an example service: $1,016 of data transferout to users5 TB, less 100 GB free$441between zones20 TB, charged each way$400through NAT3 TB processed$135to another Region2 TB replicated$40Data is free to bring in and costs money to take out or to move across a boundary.Here the chatter between zones costs $400, nearly as much as serving the users ($441). Keep talkative services in onezone, or accept it as the price of surviving a zone. Send S3 and DynamoDB traffic through gateway endpoints, not the NATgateway, and serve users through a CDN. Example list prices, us-east-1, 2025, first 10 TB a month; Regions vary.

Data transfer is charged out to the internet, between zones and between Regions: here $1,016 a month, $400 of it between zones.

Purchase options

Commit for the floor, pay on demand for peaks, use Spot for what can wait

00:0006:0012:0018:0024:00instances runningalways on: Savings Plandaytime extra: On-Demandnight batch: SpotOne day, m7i.large240 h Savings Plan at 35% off147 h On-Demand at $0.100824 h Spot at 65% offall On-Demand: $41.43 a daymatched: $31.39 a day, 24% lessMatch each slice of demand to a way of paying: commit for the floor, on demand for peaks, Spot for what can wait.Savings Plans and Reserved Instances discount a committed hourly spend for 1 or 3 years (up to 72%). Spot sells sparecapacity at up to 90% off but can take it back with two minutes’ notice, so it suits batch, CI and stateless fleets.Commit only to the floor you are sure of (discounts here are illustrative; list price us-east-1, 2025).

Savings Plans for the always-on floor, On-Demand for peaks, Spot for interruptible batch: $31.39 a day instead of $41.43.

Storage classes · Going deeper · 1 of 2

Rarely read data should not pay for instant access

100 TB kept for a year, by storage classS3 Standard$27,600read any timeStandard-IA$15,000read monthly or less; retrieval feeGlacier Instant Retrieval$4,800read quarterly, in millisecondsGlacier Flexible Retrieval$4,320minutes to hours to readGlacier Deep Archive$1,188up to 12 hours (48 for bulk)Data that is rarely read should not pay the price of data read every second: let lifecycle rules move it.Every S3 class keeps the same durability; cheaper ones charge to read and have minimum storage durations. A lifecyclerule moves objects down the classes as they age (for example to Standard-IA after 30 days, Deep Archive after a year)and deletes them when retention ends. When the pattern is unknown, S3 Intelligent-Tiering moves objects by itself.

100 TB for a year: $27,600 in S3 Standard, $1,188 in Glacier Deep Archive. Lifecycle rules move data down as it ages.

Commitments compared · Going deeper · 2 of 2

The deeper the discount, the less you may change

Way to pay for EC2Saves up toYou are locked toWhat can still changeCompute Savings Plan66%a $ an hour spend, 1 or 3 yearsfamily, size, OS, Region; Fargate and Lambda tooEC2 Instance Savings Plan72%one family in one Regionsize, OS and tenancy within that familyConvertible Reserved Instance66%an instance type, until exchangedfamily, OS, tenancy, by an exchange you makeStandard Reserved Instance72%an instance type in one Regionsize, if regional; a zonal one reserves capacityCapacity Reservationnothinga type in one zone, no termcancel any time; guarantees the capacitySpot90%nothingtaken back on 2 minutes’ noticeThe deeper the discount, the less you may change: commit only to the floor, in the loosest plan that pays.Savings Plans commit a spend; Reserved Instances commit a configuration; only a zonal RI or a Capacity Reservationholds capacity. Exam clues: “may change family or move to Fargate” means Compute Savings Plan; “must be able tolaunch in that zone” means Capacity Reservation. Elsewhere: Azure Reservations and savings plan for compute, Googlecommitted use discounts. Azure Spot gives 30 seconds’ notice, not two minutes.

A Compute Savings Plan follows you across families, Regions, Fargate and Lambda; a Reserved Instance locks a configuration for a little more.

Observability

Metrics say something is wrong; traces say where the time went

Metricsnumbers over time: latency, traffic,errors, saturation; alarmsLogsa record of each event, searchablewhen you know what to askTracesone request’s path through everyservice, with time per step0 ms60 ms120 ms180 ms240 msweb: GET /checkoutorders serviceinventory: DynamoDBpayments servicecard network APIwrite order: Aurora170 msMetrics say something is wrong, logs say what happened, traces say where the time went: here 71% in one call.CloudWatch collects metrics, alarms and logs; X-Ray or OpenTelemetry traces requests across services. Alarm on whatusers feel (error rate, p99 latency) rather than on CPU, and put every alarm next to a runbook that says what to do.

Metrics, logs and traces answer different questions. This trace shows 170 of 240 ms in one external call.

SLOs and error budgets · Going deeper · 1 of 2

An SLO turns “reliable enough” into a budget you can spend

SLO: 99.9% of requests succeed over 30 days → error budget 43.2 minutes43.2 minbad deploy, rolled back: 18 minzone failover: 12 minslow database: 6 min7.2 min leftAn SLO turns “reliable enough” into a budget of failure you can spend on change.99.9% over 30 days allows 43.2 minutes of failure. While budget remains, ship features; when it runs out, slowreleases and spend the time on reliability. It ends the argument between moving fast and staying up with a numberboth sides agreed to, and it tells you which alarms matter: the ones that burn the budget quickly.

A 99.9% SLO over 30 days is an error budget of 43.2 minutes.

Tools on three clouds · Going deeper · 2 of 2

Nine operating questions, and the tool that answers each

The questionAWSAzureGoogle CloudIs it healthy?CloudWatch metrics and alarmsAzure MonitorCloud MonitoringWhat happened?CloudWatch LogsAzure Monitor Logs (Log Analytics)Cloud LoggingWhere did the time go?X-RayApplication InsightsCloud TraceWho changed it?CloudTrailActivity LogCloud Audit LogsIs it still compliant?AWS ConfigAzure PolicyOrganization Policy; Asset InventoryWhere did the money go?Cost Explorer; Cost and Usage ReportCost Management: cost analysisBilling reports; BigQuery exportWill we overspend?AWS Budgetsbudgets in Cost ManagementCloud Billing budgetsWhat should we fix?Trusted Advisor; Compute OptimizerAzure AdvisorRecommenderIs the design sound?Well-Architected ToolWell-Architected ReviewWell-Architected FrameworkEach cloud answers the same nine questions with a differently named tool. Learn the question first.Exam clues on AWS: “who deleted it” is CloudTrail; “what was the configuration last week” is Config; “warn when theforecast passes the limit” is Budgets; “which instances are oversized” is Compute Optimizer. Tag every resource withan owner and a cost centre and activate the tags for cost allocation, or no report can answer by team.

CloudTrail says who changed it, Config what it looked like, Budgets whether you will overspend; Azure and Google have one of each.

The Well-Architected Framework

Six pillars, because a fix for one is often a cost to another

Operational excellenceCan you change, observe andrecover as routine?SecurityIs every layer protected andevery action traceable?ReliabilityDoes it survive failures andrecover by itself?Performance efficiencyAre resources the right type andsize as demand changes?Cost optimizationDo you pay only for whatdelivers value?SustainabilityDoes it use the least energy andhardware for the work?A design is reviewed against six pillars, because a fix for one is often a cost to another.The AWS Well-Architected Framework asks a set of questions per pillar, with best practices for each; the freeWell-Architected Tool records answers and flags high and medium risks. Azure and Google Cloud publish frameworkswith nearly the same pillars. The trade-offs are the point: Multi-AZ buys reliability with cost, and caching buysperformance with complexity. A review makes those choices on purpose, not by accident.

The six pillars: operational excellence, security, reliability, performance efficiency, cost optimization and sustainability.

Design review

A review turns “is it good?” into a ranked list of risks

Design under review: one EC2 instance in a public subnet runs the app and MySQL; nightly snapshotPillarFindingFixSecuritySSH open to the internet; keys in codeprivate subnets, Session Manager, IAM roleReliabilityone instance in one zone; restores untestedALB, Auto Scaling in 2 AZs, RDS Multi-AZPerformanceapp and database share one serverseparate tiers; cache hot readsCostsized for peak, On-Demand all dayauto scaling; Savings Plan for the floorOperationschanges by hand over SSH; no alarmsinfrastructure as code, pipeline, SLO alarmsSustainabilityidle capacity all nightscale in; efficient (Graviton) instancesA review turns a vague “is it good?” into a ranked list of risks with fixes.Walk the design pillar by pillar, record each risk with its impact, and fix the high risks first: here the openSSH port and the single instance, before any cost tuning. Repeat the review when the design or the load changes;every lesson in this course is one of these questions answered in depth.

Walk a design through every pillar, record the risks, and fix the high ones first.

Lesson complete

You finished “Cost, operations and reviewing a design”

Nicely done.

Open in a new tab