Skip to Content
Cloud Engineering Academy
15. Multi-Account Governance & FinOps

Commitments and rightsizing: Savings Plans, Reserved Instances, Compute Optimizer and Trusted Advisor

Cut a steady cloud bill safely: rightsize first, then size a Savings Plans commitment from your own usage data, understand Reserved Instances, and use Compute Optimizer and Trusted Advisor findings as a governed backlog.

advanced⏱ 1 h 40 min🟢 FreeSAP-C03SOA-C03SAA-C03CLF-C02

Assumes: .NET 10 LTS · AWS SDK for .NET v4 (AWSSDK.ComputeOptimizer 4.x) · AWS CLI v2 · CDK v2 (Amazon.CDK.Lib 2.277.0) · Terraform AWS provider v6 · Region us-east-1. Verified against official sources on 2026-11-18.

Learning objectives

By the end of this lesson you can:

  • Explain how a Savings Plan works (an hourly dollar commitment), how it differs from a Reserved Instance, and which type fits which workload.
  • Size a commitment from hourly usage so that it is covered almost all of the time, and calculate the saving and the downside if usage falls.
  • Explain why rightsizing comes before buying commitments.
  • Enable AWS Compute Optimizer for an organisation and read its EC2, Lambda and ECS-on-Fargate recommendations.
  • Use Trusted Advisor and Cost Optimization Hub as inputs to a cost backlog with owners.
  • Set a governance rule for who may buy commitments in a bank and what evidence is needed.

Prerequisites

  • FinOps foundations for amortized versus unblended cost and budgets.
  • Cost and Usage Reports for the line-item data that shows coverage and utilisation.
  • Pricing models, which introduces On-Demand, Savings Plans, Reserved Instances and Spot. This lesson goes deeper on commitments and avoids repeating prices from there.
  • Tools: AWS CLI v2 with learn-sandbox (and the management account for organisation-wide settings), .NET 10 SDK.

Why this matters in banking

Banking workloads are often steady. A payments platform processes transactions every hour of every day, with a daily shape but a high floor. Steady is exactly what commitment discounts reward: you promise AWS a baseline of usage and pay a lower rate for it. A bank that runs entirely On-Demand is leaving a large saving on the table. A bank that commits badly, for example by buying a three-year plan for instances it will migrate to containers next year, wastes money in a different and more painful way, because the commitment cannot be cancelled.

There is also an order of operations. Many estates are 30 to 50 percent oversized: instances chosen at launch with a safety margin nobody revisited. Buy a commitment on top of an oversized fleet and you have locked in the waste at a discount. So: delete idle things, rightsize what remains, then commit to the new baseline. This lesson follows that order, and treats commitments as a financial decision that needs a named approver, not a button an engineer presses.

The idea in plain language

A Savings Plan is a deal: "I will spend at least X dollars per hour on eligible usage for one or three years. In return, that usage is billed at a lower rate." You pay the committed amount every hour whether you use it or not. Usage beyond it is charged On-Demand.

A Reserved Instance (RI) is an older, narrower deal: "I will run this specific kind of instance (or database) for one or three years." It is a commitment to a resource shape rather than to a dollar amount per hour.

Rightsizing is choosing the smallest resource that comfortably does the job: a smaller instance, a lower Lambda memory setting, a smaller Fargate task, a different storage tier.

Analogy: a Savings Plan is a monthly gym membership priced by how many sessions you promise to attend: cheaper per visit if you do go every week, wasted if you stop. An RI is booking a specific locker for a year. Rightsizing is checking that you needed a family suite and not a single room before signing the lease.

The four Savings Plans types

From the AWS documentation (maximum discounts are headline figures, actual savings depend on usage and rates):

TypeWhat it applies toFlexibilityHeadline maximum
Compute Savings PlansEC2 (any family, size, OS, tenancy or Region), Fargate and LambdaHighest: you can move from c5 to m5, change Region or move from EC2 to Fargateup to 66%
EC2 Instance Savings PlansOne EC2 instance family in one Region (for example m5 in Virginia), any size, OS and tenancy within itMediumup to 72%
Database Savings PlansAurora, RDS, DynamoDB, ElastiCache, DocumentDB, Timestream, Neptune, Keyspaces, DMS and OpenSearch Service (latest generation provisioned instances, and serverless)High across engines and Regionsup to 35%
SageMaker AI Savings PlansSageMaker AI instance usageHigh across families and Regionsup to 64%

Terms: 1 year (365 days) or 3 years (1,095 days). Payment options: All upfront, Partial upfront or No upfront. The commitment cannot be changed after purchase. You can buy more plans later as usage grows. Some charges are not discounted: for example, the Dedicated Instance per-Region fee. EKS control-plane charges are not covered, but the EC2 instances in an EKS cluster are.

Database Savings Plans are newer

Database Savings Plans were announced in late 2025 (see the pricing models lesson's reading list). Check exactly which engines and instance generations qualify before you plan around them. ⚠ VERIFY the covered list, the headline discount and Regional availability.

Reserved Instances in one table

AspectSavings PlanReserved Instance
CommitmentDollars per hourA specific resource shape (family, size or normalised units, platform, Region or AZ)
FlexibilityHigh for ComputeStandard RIs lower, Convertible RIs can be exchanged for equal-or-greater value ⚠ VERIFY exchange rules
Capacity reservationNot by itselfA zonal RI reserves capacity in an Availability Zone
ServicesEC2, Fargate, Lambda (Compute), plus family-specific plansEC2, RDS, ElastiCache, OpenSearch, Redshift and others
ResaleCannot be resoldStandard EC2 RIs can be sold on the RI Marketplace ⚠ VERIFY current eligibility
Today's default advicePrefer for computeStill relevant for some databases and capacity reservation

Capacity reservation is a separate concern from price. If you need guaranteed capacity in a particular zone for a critical service, use an On-Demand Capacity Reservation or a zonal RI deliberately, and treat the price discount as a bonus.

What problem the AWS service solves

ToolProblem it solvesHonest limits
Savings Plans recommendations (Cost Explorer)Suggests a commitment from your past usageLooks backwards (7, 30 or 60 days, ⚠ VERIFY options); it does not know about migrations, launches or planned decommissioning
Savings Plans utilisation and coverage reportsUtilisation: how much of your commitment was used. Coverage: how much of your eligible usage the plan coveredReports are by plan and by time; they lag like other billing data
AWS Compute OptimizerRightsizing and idle-resource findings for EC2, Auto Scaling groups, EBS, Lambda, ECS on Fargate, RDS and Aurora, NAT gateways, DynamoDB, ElastiCache and moreNeeds opt-in; needs enough metric history; default lookback is 14 days, with a paid enhanced mode up to 93 days; memory metrics for EC2 need the CloudWatch agent or an external source for best results
Cost Optimization HubOne place that consolidates recommendations (rightsizing, idle, commitments) across accounts with estimated savingsIt is a summary of other tools' findings. Check each before you act ⚠ VERIFY current sources and pricing
Trusted AdvisorChecks for cost, security, fault tolerance, performance and service limitsThe full set of checks needs a Business, Enterprise On-Ramp or Enterprise support plan ⚠ VERIFY; findings are generic and need human judgement

None of these tools makes the decision. They give you findings. A person who understands the workload decides whether a "smaller instance" is safe at month end, or whether the idle server is the DR standby.

Microsoft / Azure comparison

You know (Microsoft/Azure)AWS equivalentWhat's different
Azure ReservationsReserved Instances; Savings PlansAWS Savings Plans are hourly-dollar commitments, similar in spirit to Azure Savings Plan for compute
Azure Savings Plan for computeCompute Savings PlansVery similar. AWS also has family-specific EC2 Instance Savings Plans and Database Savings Plans
Azure Hybrid BenefitBring your own licence, License IncludedWindows Server and SQL Server licensing choices affect price; see the migration module
Azure Advisor (cost)Compute Optimizer, Cost Optimization Hub, Trusted AdvisorSeveral tools rather than one blade; Trusted Advisor depth depends on support plan
Azure Spot VMsEC2 Spot InstancesInterruption notice is 2 minutes on AWS ⚠ VERIFY; same idea: fault-tolerant work only
Reservation scope: shared vs single subscriptionDiscount sharing across linked accounts in the organisationSharing is on by default and can be turned off per account in billing preferences ⚠ VERIFY wording
VM size recommendations from AdvisorCompute Optimizer rightsizing with performance-risk scoresEach recommendation shows predicted utilisation and a risk rating

Architecture

Security-boundary view: commitments are financial instruments. Purchase rights (savingsplans:CreateSavingsPlan, ce:* recommendation actions, EC2 RI purchase) belong to a small role in the management account. Engineers in workload accounts can read recommendations for their own account but cannot buy. An SCP can deny purchase actions for everyone but that role. Add a change record to every purchase.

Step-by-step implementation

Remove idle first

List unattached EBS volumes, stopped instances that have been stopped for weeks, idle load balancers, unused NAT gateways and old snapshots. Deleting beats discounting.

Enable Compute Optimizer for the organisation

Opt in from the management account including member accounts. Give it at least 14 days, ideally longer with enhanced metrics for your largest resources. For EC2, install the CloudWatch agent for memory metrics, or Compute Optimizer will judge on CPU and network only.

Triage recommendations as a backlog

Export recommendations, filter to findings such as over-provisioned, keep those with low performance risk and meaningful savings, and create a ticket per resource with its owner. For production, apply through the normal change process and test the smaller size first.

Measure the stable baseline

After the changes settle, take hourly eligible spend (at On-Demand-equivalent rates) for the last 30 to 60 days. Look at the low points, not the average. The minimum or a low percentile is the floor you will use every hour.

Size the commitment conservatively

Commit to a figure at or below the floor, for example the 5th to 10th percentile of hourly usage, covering part of the floor first. Many organisations aim for 70 to 80 percent coverage of eligible steady usage, rising over time. ⚠ VERIFY your firm's target coverage and utilisation policy.

Choose type, term and payment

Compute Savings Plans if you may change instance families, Region, or move toward Fargate and Lambda. EC2 Instance Savings Plans only for a settled family with a stable roadmap. One year unless there is strong confidence for three. No upfront or partial upfront according to Finance's cost of capital.

Approve, buy and monitor

Get a named approver. Buy in the management account so the discount can be shared. Create Savings Plans utilisation and coverage budgets (alert when utilisation falls under, say, 95 percent). Stagger purchases through the year to avoid a cliff of expiries.

AWS Console instructions

  • Compute Optimizer: Console → AWS Compute Optimizer → Get started / Opt in (management account: choose Include all member accounts ⚠ VERIFY wording). The dashboard shows findings by resource type. Recommendations lists EC2 instances and the options per instance. Settings → Recommendation preferences sets enhanced infrastructure metrics.
  • Savings Plans recommendations: Console → Billing and Cost Management → Savings Plans → Recommendations. Choose the plan type, term, payment option and lookback period, then read the recommended hourly commitment and the estimated savings. Purchase Savings Plans opens a cart; review and submit.
  • Utilisation and coverage: Billing and Cost Management → Savings Plans → Utilization report / Coverage report.
  • Cost Optimization Hub: Console → Billing and Cost Management → Cost Optimization Hub, enable it in the management account for all accounts. ⚠ VERIFY.
  • Trusted Advisor: Console → Trusted Advisor → Cost optimization. A subset of checks is available on the basic support plan.
  • Discount sharing: Billing and Cost Management → Billing preferences → Reserved Instance and Savings Plans discount sharing (management account). ⚠ VERIFY wording.

AWS CLI

# 1) Enable Compute Optimizer for the account, including member accounts (management account).
aws compute-optimizer update-enrollment-status --status Active --include-member-accounts \
  --profile learn-mgmt --region us-east-1

# 2) EC2 recommendations: instance, finding, and the best option's saving.
aws compute-optimizer get-ec2-instance-recommendations \
  --query 'instanceRecommendations[].{arn:instanceArn,finding:finding,current:currentInstanceType,best:recommendationOptions[0].instanceType,risk:recommendationOptions[0].performanceRisk,saving:recommendationOptions[0].savingsOpportunity.estimatedMonthlySavings.value}' \
  --output table --profile learn-sandbox --region us-east-1

# 3) Lambda memory recommendations and ECS-on-Fargate recommendations.
aws compute-optimizer get-lambda-function-recommendations --profile learn-sandbox --region us-east-1
aws compute-optimizer get-ecs-service-recommendations --profile learn-sandbox --region us-east-1

# 4) Export all EC2 recommendations to S3 for a spreadsheet or Athena (bucket needs the right policy ⚠ VERIFY).
aws compute-optimizer export-ec2-instance-recommendations \
  --s3-destination-config bucket=hl-finops-reports,keyPrefix=compute-optimizer/ \
  --include-member-accounts --profile learn-mgmt --region us-east-1

# 5) Savings Plans recommendation (Cost Explorer API, management account).
aws ce get-savings-plans-purchase-recommendation \
  --savings-plans-type COMPUTE_SP --term-in-years ONE_YEAR --payment-option NO_UPFRONT \
  --lookback-period-in-days THIRTY_DAYS \
  --profile learn-mgmt --region us-east-1

# 6) How well are existing plans used and how much usage do they cover? (last 30 days)
aws ce get-savings-plans-utilization \
  --time-period Start=2026-10-19,End=2026-11-18 --profile learn-mgmt --region us-east-1
aws ce get-savings-plans-coverage \
  --time-period Start=2026-10-19,End=2026-11-18 --granularity MONTHLY \
  --profile learn-mgmt --region us-east-1

# 7) Trusted Advisor (needs a support plan that includes the API ⚠ VERIFY; the API endpoint is in us-east-1).
aws support describe-trusted-advisor-checks --language en \
  --query 'checks[?category==`cost_optimizing`].[id,name]' --output table \
  --profile learn-mgmt --region us-east-1

# 8) Quick idle-resource sweep: unattached EBS volumes.
aws ec2 describe-volumes --filters Name=status,Values=available \
  --query 'Volumes[].[VolumeId,Size,CreateTime]' --output table \
  --profile learn-sandbox --region us-east-1

Option names for the recommendation calls (--lookback-period-in-days, term and payment strings) follow the Cost Explorer API. ⚠ VERIFY with aws ce get-savings-plans-purchase-recommendation help. Never buy from the CLI as a learning step: aws savingsplans create-savings-plan creates a real, non-cancellable commitment (there is a short return window for some purchases, see the documentation ⚠ VERIFY). This lesson never asks you to buy.

Infrastructure as Code

Commitments are deliberately not managed as code in this lesson: a Savings Plan cannot be deleted by cdk destroy, so putting it in a stack is a trap. What you do manage as code is the safety net: a utilisation budget that alerts when a plan is underused, and an SCP that stops anyone except the FinOps role buying commitments. L1 constructs. ⚠ VERIFY property names.

CommitmentGuardrailsStack.cs
using System.Collections.Generic;
using Amazon.CDK;
using Amazon.CDK.AWS.Budgets;
using Amazon.CDK.AWS.Organizations;
using Constructs;

namespace Harbourline.Governance.Infra;

public sealed class CommitmentGuardrailsStack : Stack
{
    public CommitmentGuardrailsStack(
        Construct scope, string id, string workloadsOuId, string finopsRoleArn, string finopsEmail,
        IStackProps? props = null) : base(scope, id, props)
    {
        Amazon.CDK.Tags.Of(this).Add("Project", "cea-lab");
        Amazon.CDK.Tags.Of(this).Add("Lab", "m15-l11");
        Amazon.CDK.Tags.Of(this).Add("Environment", "learn");

        // --- SCP: only the FinOps role may buy commitments ----------------------------------------
        var scp = new Dictionary<string, object>
        {
            ["Version"] = "2012-10-17",
            ["Statement"] = new object[]
            {
                new Dictionary<string, object>
                {
                    ["Sid"] = "DenyCommitmentPurchaseExceptFinOps",
                    ["Effect"] = "Deny",
                    ["Action"] = new[]
                    {
                        "savingsplans:CreateSavingsPlan",
                        "ec2:PurchaseReservedInstancesOffering",
                        "rds:PurchaseReservedDBInstancesOffering",
                        "elasticache:PurchaseReservedCacheNodesOffering",
                    },
                    ["Resource"] = "*",
                    ["Condition"] = new Dictionary<string, object>
                    {
                        ["ArnNotLike"] = new Dictionary<string, object>
                        {
                            ["aws:PrincipalArn"] = new[] { finopsRoleArn },
                        },
                    },
                },
            },
        };

        new CfnPolicy(this, "CommitmentPurchaseScp", new CfnPolicyProps
        {
            Name = "hl-deny-commitment-purchase",
            Description = "Only the FinOps role buys commitments. Test in Sandbox first.",
            Type = "SERVICE_CONTROL_POLICY",
            Content = scp,
            TargetIds = new[] { workloadsOuId },
        });

        // --- Budget: alert when Savings Plans utilisation drops under 95 percent ------------------
        new CfnBudget(this, "SavingsPlansUtilization", new CfnBudgetProps
        {
            Budget = new CfnBudget.BudgetDataProperty
            {
                BudgetName = "hl-savings-plans-utilization",
                BudgetType = "SAVINGS_PLANS_UTILIZATION",
                TimeUnit = "DAILY",
                BudgetLimit = new CfnBudget.SpendProperty { Amount = 95, Unit = "PERCENTAGE" },
            },
            NotificationsWithSubscribers = new[]
            {
                new CfnBudget.NotificationWithSubscribersProperty
                {
                    Notification = new CfnBudget.NotificationProperty
                    {
                        NotificationType = "ACTUAL",
                        ComparisonOperator = "LESS_THAN",
                        Threshold = 95,
                        ThresholdType = "PERCENTAGE",
                    },
                    Subscribers = new[]
                    {
                        new CfnBudget.SubscriberProperty { SubscriptionType = "EMAIL", Address = finopsEmail },
                    },
                },
            },
        });
    }
}

Complete code

One small tool with two commands. size works on a plain CSV of hourly eligible spend and needs no AWS access, so you can learn the maths for free. rightsize lists Compute Optimizer EC2 findings where savings exist.

CommitTool.csproj
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>
  <ItemGroup>
    <!-- Look up exact 4.x versions at https://api.nuget.org/v3-flatcontainer/<id>/index.json -->
    <PackageReference Include="AWSSDK.ComputeOptimizer" Version="4.*" />
  </ItemGroup>
</Project>
Program.cs
using System.Globalization;
using Amazon.ComputeOptimizer;
using Amazon.ComputeOptimizer.Model;

if (args.Length == 0)
{
    Console.WriteLine("Usage:");
    Console.WriteLine("  size <hourly.csv> <discountPercent> [percentile=10]   (no AWS access needed)");
    Console.WriteLine("  rightsize [minMonthlySavingsUsd=20]                    (reads Compute Optimizer)");
    return 1;
}

return args[0] switch
{
    "size" => Size(args),
    "rightsize" => await RightSizeAsync(args),
    _ => Unknown(args[0]),
};

static int Unknown(string command)
{
    Console.Error.WriteLine($"Unknown command '{command}'.");
    return 1;
}

// ---- size: commitment sizing from hourly on-demand-equivalent spend -------------------------
static int Size(string[] args)
{
    if (args.Length < 3) { Console.Error.WriteLine("size needs <hourly.csv> <discountPercent>"); return 1; }

    // One number per line (USD per hour at On-Demand-equivalent rates). Lines starting with # are ignored.
    var hourly = File.ReadAllLines(args[1])
        .Where(l => !string.IsNullOrWhiteSpace(l) && !l.TrimStart().StartsWith('#'))
        .Select(l => decimal.Parse(l.Split(',')[^1], CultureInfo.InvariantCulture))
        .OrderBy(x => x)
        .ToArray();

    decimal discount = decimal.Parse(args[2], CultureInfo.InvariantCulture) / 100m;
    int percentile = args.Length > 3 ? int.Parse(args[3], CultureInfo.InvariantCulture) : 10;

    // Baseline = the Nth percentile of hourly usage: usage is at or above this level (100-N)% of hours.
    int index = Math.Clamp((int)Math.Floor(hourly.Length * percentile / 100.0), 0, hourly.Length - 1);
    decimal baselineOnDemand = hourly[index];

    // A Savings Plan commitment is expressed at the DISCOUNTED rate.
    decimal commitmentPerHour = Math.Round(baselineOnDemand * (1 - discount), 2);

    decimal onDemandTotal = hourly.Sum();
    decimal withPlanTotal = 0m;
    decimal unusedCommitment = 0m;

    foreach (var usage in hourly)
    {
        decimal discountedUsage = usage * (1 - discount);          // cost of this hour if fully covered
        decimal covered = Math.Min(discountedUsage, commitmentPerHour);
        decimal overflow = (discountedUsage - covered) / (1 - discount); // On-Demand cost of the uncovered share
        withPlanTotal += commitmentPerHour + overflow;             // you always pay the commitment
        unusedCommitment += commitmentPerHour - covered;
    }

    decimal saving = onDemandTotal - withPlanTotal;
    Console.WriteLine($"Hours analysed:           {hourly.Length}");
    Console.WriteLine($"Baseline (P{percentile}):             {baselineOnDemand:N2} USD/hour on-demand equivalent");
    Console.WriteLine($"Suggested commitment:     {commitmentPerHour:N2} USD/hour (discounted rate)");
    Console.WriteLine($"On-demand total:          {onDemandTotal:N2} USD");
    Console.WriteLine($"With plan total:          {withPlanTotal:N2} USD");
    Console.WriteLine($"Saving:                   {saving:N2} USD ({(onDemandTotal == 0 ? 0 : saving / onDemandTotal * 100):F1}%)");
    Console.WriteLine($"Unused commitment:        {unusedCommitment:N2} USD");
    Console.WriteLine("Illustrative maths only: use the Cost Explorer recommendation and your own approval process before buying.");
    return 0;
}

// ---- rightsize: Compute Optimizer EC2 findings with real savings ----------------------------
static async Task<int> RightSizeAsync(string[] args)
{
    double minSavings = args.Length > 1 ? double.Parse(args[1], CultureInfo.InvariantCulture) : 20;
    using var client = new AmazonComputeOptimizerClient();

    var rows = new List<(string Name, string Current, string Best, double Risk, double Saving)>();
    string? token = null;
    do
    {
        var response = await client.GetEC2InstanceRecommendationsAsync(new GetEC2InstanceRecommendationsRequest
        {
            NextToken = token,
            MaxResults = 100,
        });

        foreach (var rec in response.InstanceRecommendations ?? [])
        {
            var best = rec.RecommendationOptions?.OrderBy(o => o.Rank).FirstOrDefault();
            double saving = best?.SavingsOpportunity?.EstimatedMonthlySavings?.Value ?? 0;
            if (best is null || saving < minSavings) continue;

            rows.Add((rec.InstanceName ?? rec.InstanceArn, rec.CurrentInstanceType, best.InstanceType, best.PerformanceRisk ?? 0, saving));
        }

        token = string.IsNullOrEmpty(response.NextToken) ? null : response.NextToken;
    }
    while (token is not null);

    Console.WriteLine($"{"Instance",-34} {"Current",-12} {"Suggested",-12} {"Risk",5} {"Saving/mo",10}");
    foreach (var r in rows.OrderByDescending(x => x.Saving))
    {
        Console.WriteLine($"{r.Name,-34} {r.Current,-12} {r.Best,-12} {r.Risk,5:F1} {r.Saving,10:N2}");
    }
    Console.WriteLine($"\n{rows.Count} recommendations, total estimated saving {rows.Sum(r => r.Saving):N2} USD per month.");
    Console.WriteLine("Check performance risk and ownership before changing anything. Risk of 3 or more needs a test first.");
    return 0;
}

An input file to try the size command (a day of a payments platform's hourly spend, repeated to form a week is enough). Paste at least 24 numbers:

hourly.csv
# USD per hour at on-demand-equivalent rates (fictional)
6.1
5.9
5.8
5.7
5.8
6.0
6.8
8.2
9.5
10.1
10.4
10.2
10.0
9.8
9.6
9.9
10.3
10.8
10.1
9.0
8.0
7.2
6.6
6.2

Run dotnet run -- size hourly.csv 30 for a 30 percent discount. Percentile 10 is roughly 5.8 dollars an hour, so the commitment is about 4.06 dollars an hour at the discounted rate and covers the floor of the daily pattern. The saving applies to the covered baseline only, while the daytime peaks above it still pay On-Demand rates. Try percentile 50 and see how unused commitment appears at night.

Code explained line by line

  1. The switch expression dispatches the two commands. size is synchronous because it only reads a file, and rightsize awaits the AWS call.
  2. size reads one number per line, ignoring blanks and # comments, and sorts the values ascending. l.Split(',')[^1] takes the last field so the same file can hold timestamp,value rows from a real export.
  3. The baseline is a percentile of hourly usage. At percentile 10, usage is at or above this value in 90 percent of hours. That is what "steady floor" means in numbers.
  4. The commitment is quoted at the discounted rate, because a Savings Plan is a dollar-per-hour amount of discounted usage. This detail catches people out when they compare the console recommendation with their own spreadsheet.
  5. For each hour, covered is the part of that hour's discounted usage that the commitment absorbs, and overflow converts the excess back to its On-Demand cost. The hour's cost is the commitment (always paid) plus the overflow.
  6. unusedCommitment accumulates the hours when usage was under the commitment. That waste is the risk side of the deal. If it is more than a few percent, the commitment is too high.
  7. rightsize pages through Compute Optimizer results with NextToken, takes the best-ranked option per instance, and filters out anything saving less than a threshold so the list is actionable. Properties are null-checked (?.) because v4 SDK objects can have unset members.
  8. Output is sorted by saving and ends with a reminder: performance risk is a Compute Optimizer score, and anything with a higher score should be tested first.

Security considerations

⚠ Learning shortcut — not for production

The lab computes and reads, and never buys. In production, a purchase is a financial commitment with a named approver, a ticket, Finance sign-off and a plan for what happens at expiry. Purchase permissions are limited by SCP to one role, purchases are logged in CloudTrail, and a Savings Plans utilisation budget alerts when a plan is underused. The recommendation tool runs with read-only Compute Optimizer and Cost Explorer permissions.

  • Rightsizing is a change to production. A smaller instance may be fine on average and fail at month end. Use the performance-risk score, test in a lower environment, change in a window with rollback ready, and watch latency and error alarms afterwards.
  • Do not rightsize security tooling or DR standbys blindly. Low utilisation is the point of a standby. Tag these resources so recommendation reviews can exclude them.
  • Recommendation data is inventory. Exports list instances, accounts and sizes. Keep them in the FinOps account with limited access.
  • Delegated administrator. Compute Optimizer and Cost Optimization Hub can be administered from a delegated account so the management account does not become the working console. ⚠ VERIFY current delegation support.
  • Compliance. A cost saving never overrides a control. If a recommendation conflicts with a regulatory or resilience requirement (for example an operational-resilience impact tolerance), the requirement wins and the exception is documented.

Banking use case

Harbourline's Payments platform runs on 40 EC2 instances and Fargate tasks. A 60-day review finds an hourly floor of about 5.8 dollars at On-Demand-equivalent rates and peaks above 10. Compute Optimizer flags 11 instances as over-provisioned, and the team halves the size of 7 after testing. The new floor drops to about 4.9 dollars an hour. Only then does FinOps buy a one-year, no-upfront Compute Savings Plan at 4.9 dollars times the discount factor, deliberately a little under the floor, approved by the head of platform and the finance partner. Compute Savings Plans are chosen because the roadmap includes moving the batch workload from EC2 to Fargate. A quarterly review checks utilisation (target above 95 percent) and coverage, and the team stages a second plan six months later rather than one large purchase. Total saving in the first year is close to a quarter of the compute bill, and almost half of that came from rightsizing alone.

Common mistakes

  • Committing before rightsizing. You lock in oversized capacity.
  • Committing to the average. Hours below the commitment waste money. Use the floor.
  • Choosing a three-year term for a changing estate. Cloud roadmaps change faster than commitments.
  • Choosing EC2 Instance Savings Plans and then changing family. For example, a move to Graviton instances leaves an x86 family plan uncovered. Compute Savings Plans are more forgiving.
  • Ignoring Lambda and Fargate. Compute Savings Plans cover them, but a plan sized only from EC2 data misses part of the baseline.
  • Trusting the recommendation without context. It cannot know about next month's decommissioning or migration.
  • Buying in a member account. The discount may not be shared as expected, and ownership becomes unclear. Purchase in the management account unless there is a reason not to.
  • No utilisation monitoring. A plan that quietly runs at 70 percent utilisation is a 30 percent loss on the commitment.

Troubleshooting

SymptomLikely causeFix
Compute Optimizer shows no recommendationsNot opted in, or not enough metric data (needs about 30 hours of metrics for a first pass ⚠ VERIFY)Opt in, wait, and check the resource type is supported
EC2 recommendations ignore memoryNo CloudWatch agent memory metricInstall the agent or use external metric ingestion ⚠ VERIFY
OptInRequiredExceptionAccount not enrolledRun update-enrollment-status --status Active
Member accounts missing from organisation view--include-member-accounts not set, or delegated admin not configuredEnable organisation access from the management account
Savings Plans recommendation is emptyNot enough eligible usage, or the plan type does not match your usageTry another type or lookback; check eligible services
Utilisation below 100 percent immediately after purchaseUsage dropped, or another plan or RI already covers the same usageCompare the commitment with the floor; check overlapping commitments
AccessDenied on ce:GetSavingsPlansPurchaseRecommendationRole lacks Cost Explorer recommendation permissions or is a member accountUse a role in the management account with the right actions
Trusted Advisor API returns SubscriptionRequiredExceptionSupport plan does not include the APIUse the console, or upgrade only if justified ⚠ VERIFY

Cost and cleanup

Cost: free. Compute Optimizer default recommendations are free. Enhanced infrastructure metrics are a paid add-on, which you do not need for this lesson. Savings Plans recommendations, utilisation and coverage reports are free. Trusted Advisor's basic checks are free. Cost Explorer API calls are charged per request ⚠ VERIFY. This lesson never purchases a commitment, so there is nothing to cancel. If you have a sandbox account with no resources, Compute Optimizer will simply report nothing, so use the size command with the sample file, or read the findings from a non-production account you already run.

Cleanup:

# Optional: turn Compute Optimizer off again if you only opted in for the lesson.
aws compute-optimizer update-enrollment-status --status Inactive \
  --profile learn-sandbox --region us-east-1

# Remove the lab SCP and budget if you deployed them.
aws organizations detach-policy --policy-id p-abc123 --target-id ou-abcd-11111111 --profile learn-mgmt
aws organizations delete-policy --policy-id p-abc123 --profile learn-mgmt
aws budgets delete-budget --account-id 111122223333 --budget-name hl-savings-plans-utilization \
  --profile learn-mgmt --region us-east-1

# Remove local files.
rm -f hourly.csv

If you did buy a Savings Plan while experimenting, stop and check the Savings Plans console now: some purchases can be returned within a short window after purchase and under strict conditions. ⚠ VERIFY the current return policy. Do not rely on it.

Exercises

  • 🟢 Guided: run size on the sample file at percentiles 5, 10, 25 and 50 with a 30 percent discount. Write down how the saving and the unused commitment change.
  • 🟡 Challenge: add a --payment option that models No upfront versus All upfront by adding a discount uplift and an upfront cash amount, and report the cost of capital at 6 percent a year.
  • 🔴 Live problem: the CFO wants a three-year, All upfront Compute Savings Plan for 100 percent of current compute spend "to lock in the best rate". Write your reply: what you will check, what you would buy instead, and what must happen before purchase.

Assignment

Add governance/commitments/ to your portfolio repository with the tool, a one-page commitment-policy.md (who approves, coverage and utilisation targets, term rules, review cadence, rightsizing-first rule) and the SCP.

Solutions

Knowledge check

Interview questions

  • How do you decide how much to commit? Rightsize first, use the hourly floor over 30 to 60 days, commit at or below it, choose the flexible type unless the roadmap is stable, stagger purchases, and monitor utilisation.
  • Savings Plans or Reserved Instances? Savings Plans for compute (flexibility, Fargate and Lambda), Database Savings Plans or RIs for databases depending on engine coverage, and RIs or capacity reservations when you need reserved capacity.
  • What is the downside of a three-year commitment? It cannot be cancelled. A migration, architecture change or business change can leave you paying for usage that no longer exists.
  • Who in a bank should be allowed to buy commitments? A small FinOps role with Finance approval and an audit trail, enforced with SCPs.

Certification practice

Completion checklist

  • I can explain a Savings Plan versus a Reserved Instance in two sentences
  • I ran the size command at several percentiles and understand unused commitment
  • I know why rightsizing comes first
  • I read Compute Optimizer findings (or the lesson sample) and triaged them by risk
  • I wrote a commitment policy with approvers and targets
  • I did not buy anything, and I ran the cleanup steps

Key takeaways

  • Order: delete idle, rightsize, then commit to the floor.
  • A Savings Plan is an hourly dollar commitment. It cannot be changed, so size it conservatively.
  • Compute Savings Plans are the flexible default. Family-specific plans give more discount for less freedom.
  • Recommendations are inputs. A named human approves changes and purchases.
  • Monitor utilisation and coverage as you monitor any other control.

Further reading

Independent learning resource — not affiliated with, endorsed or sponsored by Amazon Web Services. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. All banking data in examples is fictional. Sample architectures are for learning and are not automatically compliant with GDPR, PCI DSS or any banking regulation.

On this page