SA

AWS Domain 4 – Cost Optimization Vocabulary

Key Definitions

Storage Terminology

  • Object Storage (Amazon S3)
    • Manages data as discrete “objects” in a flat address space.
    • Highly durable, virtually unlimited scale.
    • Example use-case: log archives, media files, backups.
  • Block Storage (Amazon EBS)
    • Presents raw, unformatted block devices to EC2. behaves like disks.
    • Low-latency, random I/O; ideal for OS & database volumes.
  • File Storage (Amazon EFS / Amazon FSx)
    • POSIX-compatible hierarchical file system exposed over NFS/SMB.
    • Multiple EC2 instances can share the same filesystem.
  • Ephemeral Storage (EC2 Instance Store)
    • Local NVMe/SATA disks physically attached to host.
    • Highest performance, but data lost when instance stops, terminates, or fails.
  • Cost Allocation Tags
    • Key-value pairs applied to resources.
    • Surface in Cost Explorer & Cost and Usage Report (CUR) for granular chargeback/showback.
  • AWS Cost Explorer
    • Interactive UI for visualising spend & usage trends; 12-month history + 12-month forecast.
  • AWS Cost and Usage Report (CUR)
    • Hourly/line-item CSV or Parquet delivered to S3; ingest with Athena/QuickSight for deep analytics.
  • S3 Lifecycle Configuration
    • Rule set that transitions or expires objects automatically (e.g. 30-day → IA, 90-day → Glacier).
  • S3 Intelligent-Tiering
    • Monitors each object and moves it between frequent & infrequent tiers when access patterns change.
    • 99.9\% availability, no retrieval latency, small per-object monitoring fee.
  • AWS Snowball (Snow Family)
    • Rugged petabyte-scale appliance for bulk data transfer; eliminates long WAN uploads.
  • Consolidated Billing (AWS Organizations)
    • Parent (“management”) account receives one invoice; savings plans/RIs share across members.

Compute & Pricing Models

  • On-Demand – pay per second/hour, 0 commitment, highest rate.
  • Reserved Instances (RI) – commit to specific attributes for 1/3 yrs, up to 72\% discount.
  • Savings Plans – commit to \$ /\text{hr} spend; flexible across instance family, size, AZ, OS, even Fargate & Lambda.
  • Spot Instances – spare capacity, up to 90\% off, reclaimable with 2-minute warning.
  • Right-Sizing – selecting the smallest instance/volume that still meets performance SLAs.
  • Elasticity – scale out/in automatically; pay only for what you use.

Database Terms

  • Relational DB (Amazon RDS / Aurora) – structured tables, ACID transactions, SQL.
  • NoSQL DB (Amazon DynamoDB) – key-value / document, serverless, single-digit-ms latency.
  • Read Replica – asynchronous read-only copy; off-loads reads, increases aggregate throughput.
  • Point-in-Time Recovery (PITR) – restore any second within retention window via logs.
  • Aurora Serverless – auto-pauses & scales capacity in 1 sec increments; pay per ACU-second.
  • Amazon ElastiCache – managed Redis/Memcached; micro-second latency caching layer.

Networking Glossary

  • Site-to-Site VPN – IPSec tunnel over internet; cheapest hybrid choice.
  • AWS Direct Connect (DX) – dedicated fiber circuit; predictable bandwidth, lower per-GB egress.
  • VPC Peering – 1-to-1 private routing between two VPCs; no transitive routing.
  • AWS Transit Gateway (TGW) – hub-and-spoke router for 1000s of VPCs/on-prem; per-GB processing fee.
  • Gateway VPC Endpoint – FREE S3/DynamoDB private access; removes NAT/Data-Transfer-Out charges.
  • NAT Gateway – managed NAT for private subnets; hourly + per-GB processing cost.
  • Amazon CloudFront – global CDN; free origin → edge transfer, lower egress to users.

Storage Fundamentals & Sizing

  • Match storage type to workload requirement (file vs block vs object).
    • Example – app needs shared POSIX FS ⇒ choose EFS, not S3.
  • Cheapest compute-adjacent storage = Instance Store (free with EC2 price) but non-persistent.
  • Continuous right-sizing: monitor \text{CPU},\text{RAM},\text{IOPS}, throughput, GB-used.

Amazon EBS Cost Optimisation

  • Use AWS Trusted Advisor to flag unattached volumes; delete to stop accruing /GiB\text{/month}.
  • Volume type migration – io1/io2 → gp3 if high IOPS no longer required.
  • Snapshots – automate via Data Lifecycle Manager (DLM); set creation & retention policies.

Amazon S3 Cost Optimisation

  • Know storage-class trade-offs: \text{Standard} > \text{Standard-IA} > \text{One Zone-IA} > \text{Glacier} > \text{Deep Archive} (ascending retrieval time, descending cost).
  • Lifecycle Policies for predictable age-based transitions & expiration.
  • Intelligent-Tiering for unknown / changing access; object-level automation.
  • Requester Pays buckets shift egress charges to downloader.
  • Centralise backups with AWS Backup; define retention to delete aged copies.

Data Migration & Transfer

  • Bulk seeding (TB→PB) → AWS Snowball fastest & cheapest.
  • Ongoing hybrid sync → AWS DataSync, Transfer Family, Storage Gateway.
  • High-volume dedicated link → Direct Connect; lower long-term /GB than internet.

Monitoring, Management & Governance

  • Amazon CloudWatch: collect metrics, set alarms, create dashboards.
  • Tagging Strategy essential; tags surface in Cost Explorer & CUR for chargeback.
  • Tool selection:
    Cost Explorer → interactive, high-level.
    CUR → raw, line-item; query with Athena/QuickSight.
  • AWS Budgets: set thresholds, e-mail/SNS alerts, or auto actions (e.g. shut down dev at night).
  • AWS Organizations + Consolidated Billing: aggregate usage for volume discounts; single invoice.
  • AWS Control Tower: opinionated multi-account landing zone; guardrails & budget enforcement.

Cost-Optimised Compute Solutions

Five Pillars

  1. Right-Sizing
    • Pick correct instance family (C = compute, R = memory, M/T = general).
    • Hybrid hardware (Outposts) still follows right-size principle.
  2. Increase Elasticity
    • EC2 Auto Scaling adds/removes instances per demand; prefer horizontal scale (many small).
    • Tag groups for policy targeting.
  3. Pricing Model Selection
    • On-Demand, RI, Savings Plan, Spot; align to workload predictability & fault-tolerance.
    • Savings Plans = modern, service-agnostic discount mechanism.
  4. Match Storage to Usage
    • Optimise attached EBS (size, type) to avoid waste.
  5. Continuous Monitoring & Improvement
    • CloudWatch metrics → right-size candidates.
    • Cost Explorer → visualize trends.

Load Balancing & Scaling

  • Elastic Load Balancing (ELB) distributes traffic & supplies health metrics to Auto Scaling.
  • Configure RequestCountPerTarget scaling policy for precise scaling.
  • Use ELB health checks for automatic replace of unhealthy instances → no wasted.

Managed Services & Edge

  • Replace self-hosted DB on EC2 → Amazon RDS/Aurora; eliminate license & admin overhead.
  • CloudFront caches at edge → reduce origin DTO & latency.

Cost-Optimised Database Solutions

Polyglot Persistence Strategy

  • Do not stuff everything into one RDS instance.
    • Large binaries → S3 (store object key in DB).
    • High-traffic, schema-flexible sets → DynamoDB.
    • Transactional relational → RDS/Aurora.

Scaling Economically

  • Read-heavy pressure → add Read Replicas (horizontal) before vertical scaling.
  • Integrate ElastiCache to serve hot queries from memory.
  • Enable RDS storage auto-scaling to grow without downtime.

Managed & Serverless

  • Prefer managed (RDS, DynamoDB) over self-managed EC2 databases for lower TCO.
  • Aurora Serverless shines for intermittent or unpredictable workloads; billed per ACU-second.

Backup & Lifecycle

  • Align snapshot schedule to RPO; no need for excessive retention.
  • Automate deletion of aged snapshots (DLM or AWS Backup).
  • Know which engines offer PITR (RDS, DynamoDB) and configure accordingly.

Cost-Optimised Network Architectures

Data Transfer Cost Rules

  • Data IN to AWS → 0.
  • Data OUT to internet → paid.
  • Inter-AZ traffic within Region → paid.
  • Inter-Region traffic → paid.
  • Same-AZ traffic → free.
  • Optimise by keeping traffic local & private.

Connectivity Choices

  • Site-to-Site VPN – default, low-cost hybrid link.
  • Direct Connect – choose only for high, steady bandwidth or compliance.
  • Cost-effective HA pattern → DX primary + VPN backup (cheaper than dual DX).

Inside the VPC

  • Use Gateway VPC Endpoints for S3/DynamoDB; free & avoids NAT.
  • VPC Peering for few VPCs (no processing fee).
  • Transit Gateway for many VPCs (simplicity outweighs per-GB fee in complex topologies).

NAT Gateway Economics

  • Production ⇒ one NAT GW per AZ for HA.
  • Dev/Test ⇒ single shared NAT GW to cut hourly & processing charges (accepts lower availability).

CloudFront & Edge Optimisation

  • Origin → edge transfer free; user delivery cheaper than origin DTO.
  • Caching reduces repeat origin calls, saving per request and per-GB.

API Gateway Cost Controls

  • Usage Plans & API Keys enforce throttles/quotas; avoid runaway consumer costs.

Region Selection

  • Some Regions (e.g. us-east-1) cheaper; deploy there if latency & compliance permit.

Cost Management Toolkit

  • Cost Explorer – visual trends, forecasts.
  • CUR – deepest granularity; join with Athena for SQL queries.
  • AWS Budgets – alert/act on threshold breaches (e.g. stop non-prod at >\$100).
  • Trusted Advisor – checks idle resources, RI coverage, security gaps.
  • CloudWatch – resource utilisation; trigger Lambda to downsize when under-utilised.

Exam “NEED-TO-KNOW” Highlights

  • Storage-class selection & S3 Lifecycle vs Intelligent-Tiering decision tree.
  • Deleting unattached EBS & old snapshots = immediate savings.
  • Read Replica vs vertical scale for read saturation.
  • Snowball fastest & cheapest for PB migrations.
  • Gateway Endpoints eliminate S3/DynamoDB data-transfer fees.
  • Spot = deepest discount; only for interruptible workloads.
  • Savings Plan = flexible commitment across services.
  • NAT GW dev pattern: single, shared gateway.
  • CloudFront: free origin-to-edge; primary DTO-saving tool.

Example Scenario Q&A

  1. S3 logs: 30-day IA, 90-day archive → use Lifecycle Configuration (predictable schedule).
  2. Minimise VPC cost → optimise NAT usage, use Gateway Endpoints, keep traffic in one AZ.
  3. Dev NAT savings → deploy one NAT GW, route all private subnets to it.
  4. Route design to cut transfer → keep compute & DB in same AZ, cache with CloudFront, use endpoints.

Formulas & Numeric References

  • Snapshot cost savings = (\text{Idle GiB}) \times (\$ /\text{GiB‐month}).
  • Spot discount up to 90\% vs On-Demand.
  • RI/Savings Plan discount up to 72\%.
  • S3 Glacier Deep Archive retrieval ≤ 12\text{ hrs}; lowest /\text{GiB‐month}.

Continuous Improvement Loop

  1. Design to requirements (functionality first).
  2. Tag & Measure (enable visibility).
  3. Analyse Spend (Cost Explorer/CUR).
  4. Optimise (right-size, automate lifecycle, choose pricing model).
  5. Repeat monthly – cloud pricing is variable; optimisation is iterative.