Cost-Optimized Compute and Storage
Module 5 · Design Cost-Optimized Architectures

Cost-Optimized Compute and Storage

Design cost-optimized compute and storage: EC2 purchase options (On-Demand, Savings Plans, Reserved Instances, Spot), right-sizing and Graviton, serverless economics, S3 storage classes and lifecycle policies, and cheaper EBS choices.

Cost Is a Design Requirement

Cost isn’t something you fix after launch. It’s a requirement like availability. The cost-optimized answer on the exam is the cheapest design that still meets every stated requirement, not the cheapest design overall.

The big levers, in rough order of impact:

  1. Don’t run what you don’t need (turn off dev environments at night, delete idle resources)
  2. Right-size what you do run
  3. Pay less per unit with commitments or Spot
  4. Use the right storage tier for how often data is accessed
  5. Reduce data transfer (covered in the next lesson)

EC2 Purchase Options

OptionDiscount vs On-DemandCommitmentBest for
On-DemandNoneNoneShort-term, unpredictable, or new workloads
Compute Savings PlansUp to 66%$/hour for 1 or 3 yearsSteady usage that may change instance family, Region, or move to Fargate or Lambda
EC2 Instance Savings PlansUp to 72%$/hour for 1 or 3 years in one instance family and RegionSteady usage on a known family
Reserved InstancesUp to 72%A specific instance configuration for 1 or 3 yearsSteady usage; also available for RDS, ElastiCache, Redshift, OpenSearch
Spot InstancesUp to 90%None, but AWS can reclaim them with a 2-minute warningFault-tolerant, flexible work: batch, CI, rendering, stateless web tiers
Dedicated Hosts—OptionalLicensing tied to physical cores or sockets, compliance

Discount figures are AWS’s “up to” numbers. Actual savings depend on term, payment option, and instance.

Most real workloads layer these options:

high000:0012:0024:00Instances running over one daySteady baseline → Savings Plans or Reserved InstancesDaytime rise → On-Demand + Auto ScalingFlexible peaks, batch → Spot

Right-sizing and Graviton

  • AWS Compute Optimizer analyzes utilization and recommends smaller or different instance types, EBS volumes, and Lambda memory settings.
  • Graviton (Arm) instances usually cost less than comparable x86 instances and often perform better, if your software runs on Arm.
  • Auto Scaling removes capacity when it isn’t needed. A fleet sized for peak all day wastes money all night.

Serverless economics

Lambda and Fargate charge for what runs, so idle costs nothing (Lambda) or very little. For spiky or low-volume workloads, serverless is often far cheaper than an always-on instance. For very high, steady load, well-utilized instances with Savings Plans can win. Compute Savings Plans cover Lambda and Fargate too.

⚠️ Common Pitfall: Spot for Work That Can't Be Interrupted

Common mistake: a design runs a single-instance production database or a long, non-checkpointed job on Spot “to save 90%.”

Spot capacity can be reclaimed with a 2-minute notice. Use it only for work that is stateless, checkpointed, or spread across many instances that can absorb the loss of a few, and diversify across instance types and AZs.


S3 Storage Classes

ClassAccess patternRetrievalMinimum storage duration
S3 StandardFrequentMillisecondsNone
S3 Intelligent-TieringUnknown or changingMilliseconds (optional archive tiers are slower)None; small monitoring fee per object
S3 Standard-IAInfrequent, but needs fast accessMilliseconds, per-GB retrieval fee30 days
S3 One Zone-IAInfrequent, re-creatable dataMilliseconds; stored in one AZ30 days
S3 Glacier Instant RetrievalRare (about once a quarter), needs instant accessMilliseconds90 days
S3 Glacier Flexible RetrievalArchiveMinutes to hours90 days
S3 Glacier Deep ArchiveLong-term archive, rarely if ever readWithin 12 hours (standard) or 48 hours (bulk)180 days

The classes trade storage price against access price:

Intelligent-Tiering moves objects across similar tiers for youStandardmsno minimumStandard-IAms + feemin 30 daysGlacier Instantms + feemin 90 daysGlacier Flexiblemin to hoursmin 90 daysDeep Archive12–48 hoursmin 180 daysStorage price per GB: lower →Retrieval cost and wait time: higher →

Lifecycle policies move objects between classes and delete them automatically:

  1. 0 Standard

    Days 0–30: active use

  2. 30 Standard-IA

    Day 30: occasional reads

  3. 90 Glacier Flexible

    Day 90: archive

  4. 1y Deep Archive

    Year 1: compliance hold

  5. 7y Expire

    Year 7: delete

Also add lifecycle rules that delete old object versions in versioned buckets and abort incomplete multipart uploads. Both quietly add up.

EBS and file storage savings

  • Move gp2 to gp3: usually about 20% cheaper per GB, with performance you can tune separately.
  • Use st1 or sc1 for large sequential data that doesn’t need SSD.
  • Delete unattached volumes and old snapshots; archive rarely needed snapshots with EBS Snapshots Archive.
  • Turn on EFS lifecycle management to move cold files to the Infrequent Access or Archive class.

Key Takeaway

Layer Savings Plans or RIs under the steady baseline, On-Demand for the predictable rise, and Spot for interruptible work. Right-size with Compute Optimizer, consider Graviton, and use serverless for spiky load. Match S3 storage classes to access patterns, automate moves with lifecycle policies, and move EBS to gp3.

🧪 Try It: Price Three Designs

Use the AWS Pricing Calculator to estimate a month of compute for an API that handles about 2 million requests a day, mostly during business hours:

  1. Two m7i.large On-Demand instances running 24/7 behind an ALB
  2. The same, but with a 1-year Compute Savings Plan for the baseline
  3. Lambda + API Gateway, assuming 200 ms average duration at 512 MB

Compare the totals, then write one sentence on when each design would be the right choice. (Hint: think about steadiness of traffic and operational effort, not just price.)

🧠 Knowledge Check

1. A nightly batch job can be stopped and resumed from checkpoints at any time. Which purchase option is MOST cost-effective?

2. A company runs steady compute 24/7 but expects to change instance families and move some services to Fargate. Which option fits BEST?

3. Log files are read often for 30 days, rarely for a year, and must be kept for 7 years for compliance. What is the MOST cost-effective approach?

4. Access patterns for a data set are unknown and change often. Which S3 class lowers cost without you predicting access?