Skip to content

Example scenario · AWS to managed Cloud Compute · simplified topology

Cutting the AWS bill in half by leaving AWS: a re-architected migration for a Canadian SaaS

A Canadian B2B analytics SaaS rebuilt its 5-year-old AWS environment onto Stack Harbor managed Cloud Compute in 12 weeks — 54% lower run-rate, faster API, Canadian data residency.

Illustrative client profile: Canadian SaaS · B2B analytics · ~50 employees · ~280 customers. This example scenario shows how we approach the work; it does not describe a specific client, and its figures are illustrative.

Outcomes

Monthly traffic
~24M API requests/mo · ~6M ingest events/day
Uptime
99.97% post-migration
Response p95
p95 286 ms API (was p95 540 ms on AWS)
Tickets
−39%
Incident response
Sev-1 ack 14 min · clear runbook chain
Migration window
11-min read-only cutover · zero data loss
MRR
Retainer + 3 new enterprise deals unlocked on data residency
Infra cost change
−54% on monthly run-rate · −41% all-in including ops time

The call we got, from the head of engineering at a fifty-person Canadian SaaS, started with a sentence that lands the same way every time: “Our AWS bill is just past nine thousand a month, our CFO is asking what we get for it, and I don’t actually have a clean answer.” The follow-up was the one that made the engagement go from a cost conversation to a rebuild. A Crown corporation had been in their pipeline for four months. The legal team had finally come back with the data-residency answer that had been holding the deal up: production data, including backups and logs, in Canada. Their AWS environment was primarily in us-east-1. They had been telling their AE for three months that this was “easy to fix.” It was not easy to fix.

We spent three weeks in their account before we proposed anything. The architecture was the architecture two engineers had built in two days, five years earlier, when the company was a four-person seed startup and the goal was to ship a demo by Friday. It had grown by accretion since: an EC2 instance here, a Lambda there, a CloudFront distribution somebody had stood up for a marketing campaign and never decommissioned. Nobody had owned the bill since the original founding engineer left in 2023. Nobody had owned the topology since it had been drawn on a whiteboard in 2020.

Below is what we found, what we rebuilt it as, how the migration ran, and what landed at ninety days.

At a glance

  • Twelve weeks, AWS to Stack Harbor managed Cloud Compute, re-architected (not lift-and-shift). Three application nodes, primary Postgres with a read replica, Redis, a worker fleet, Cloudflare in front.
  • Monthly infrastructure run-rate down 54% versus their AWS baseline. All-in 41% lower once internal ops time is included.
  • p95 API latency 286 ms post-migration, down from 540 ms on AWS, mostly from co-locating compute and database in the same network rather than crossing AZ boundaries every request.
  • Three enterprise deals closed in the first quarter post-migration that had been gated on Canadian data residency. The Crown corporation was the first.

The audit — where the money was going

Three weeks. Read-only access to the AWS account, Cost Explorer for the prior twelve months, the Trusted Advisor recommendations nobody had actioned, a walk through the production VPC with the head of engineering. We did not propose anything in week one. We did not propose anything in week two. The audit is the product.

The bill broke down roughly like this for the trailing three months:

ServiceShare of billWhat it was actually doing
EC2 instances32%22 instances, several oversized
EC2-Other20%NAT gateway egress, EBS gp2 paid like gp3, orphaned volumes
RDS (multi-AZ)18%db.m5.2xlarge Postgres, multi-AZ, oversized for actual load
Data Transfer8%Cross-AZ chatter, egress to CloudFront origins
ElastiCache6%Two cache.m5.large nodes; the working set fit in one cache.m5.medium
CloudFront5%Misconfigured cache-control; ~38% origin hit rate
Lambda + API Gateway3%15 functions, 4 of them never invoked in the trailing 90 days
S3 + everything else8%Backups, application assets, logs
Total100%

The shape of the bill was the same shape we see on most accounts that have grown organically for five years.

Zombie infrastructure. Four of the fifteen Lambda functions had not been invoked in ninety days. One was a webhook handler for a vendor the company had stopped using in 2022. Two were duplicate enrichment paths from a refactor that had been left half-done. The fourth was a debugging helper somebody had deployed in 2021. Two had IAM roles with broader permissions than the production application tier.

The RDS instance. db.m5.2xlarge running multi-AZ. CPU averaged 14% over the prior 90 days with peaks to 38% during the daily enrichment batch. Connection count averaged 22 against a max_connections of 200. The instance had been sized in 2022 against a worst-case forecast that never materialized, and nobody had revisited it. Multi-AZ was correct for production; the instance class was three steps oversized.

The NAT gateway. Roughly two-thirds of the EC2-Other line was the NAT gateway. The application nodes lived in private subnets and reached out to a handful of third-party APIs through the NAT. The egress volume was real. The NAT was correct. What was not correct was that the application tier also reached its own S3 buckets through the NAT, because the VPC endpoint for S3 had never been configured. That alone accounted for a low-single-digit percent of the entire bill — bytes being routed from one AWS service to another AWS service through a paid intermediary.

EBS volumes. Every volume in the account was gp2. AWS had introduced gp3 in late 2020 with the same performance envelope at roughly 20% lower cost. Nobody had run the migration. There were also nine orphaned volumes — left attached to instances that had been terminated, or detached and never deleted — totaling 1.4 TB and a low-single-digit-percent slice of the bill that nobody had ever audited.

CloudFront. The cache hit rate on the distribution was 38%. The origin was burning egress for content that should have been cached at the edge. The cache-control headers on the application tier were defaulting to whatever Express was emitting, which for most responses was nothing. A five-line fix had been worth a meaningful share of the CloudFront and origin-egress lines combined, and nobody had touched it.

ElastiCache. Two cache.m5.large Redis nodes in primary/replica. Memory utilization on the primary was 11%. The working set fit comfortably in a node a third of the size.

We wrote sixteen findings. Nine were cost. Five were architecture. Two were process — including the fact that nobody on staff had read the AWS bill at the line-item level in eighteen months.

When AWS is still the right answer

We say this every time we run one of these audits, and we say it before we propose anything, because Stack Harbor’s credibility depends on the call being honest.

AWS is the right answer for a lot of workloads. A team running multi-region active-active with Route 53 health checks driving regional failover, DynamoDB global tables, Aurora Global Database, and a serverless-first ingest path is making AWS work for them in a way no IaaS platform replicates. Workloads that lean hard on Kinesis, Step Functions, Athena over S3, Redshift, or SageMaker have native integrations and pricing that look very different from running equivalent pieces elsewhere. Teams with deep AWS-native skills who run production through CDK or Terraform with a mature platform engineering function get real leverage from staying inside the AWS service mesh.

This client was not that team. They were running twenty-two EC2 instances, one Postgres, one Redis, fifteen Lambdas (four of them dead), and a CloudFront distribution. The Lambdas were doing batch enrichment that ran on a cron — they did not need to be Lambdas. The CloudFront distribution was caching marketing-site assets and a handful of public API responses — Cloudflare’s free tier would have served the same purpose with less configuration. The RDS multi-AZ was correct, but the instance class was wrong. The serverless and AWS-native pieces of the architecture were carrying overhead the workload was not benefiting from.

There was also the data-residency question. AWS has Canadian regions — ca-central-1 and ca-west-1 — and they are credible. The cost of migrating this account from us-east-1 to ca-central-1 was not zero. The egress charges to move 4.2 TB of S3 objects, the cross-region snapshot copies, the rewrite of the IAM and KMS configurations, the cutover engineering — by our estimate, the AWS-to-AWS regional migration would have cost a meaningful project budget in engineering and AWS charges combined, and the run-rate post-migration would have been within ten percent of where they were starting. That is the right call for some teams. It was not the right call for this one.

We told them, on the wall: the question is not whether AWS is good. The question is whether this workload is getting value out of the AWS-shaped overhead it is paying for. Right now, no. If your roadmap takes you into serverless event processing or you decide to expand into multi-region active-active, the answer changes. Today it does not.

They wanted us to write that paragraph into the proposal. We did.

The target topology

What we proposed is not exotic. It is a topology we run for SaaS workloads in this size class week in and week out. The boring shape is the point.

  • Three application nodes behind a TCP/HTTP load balancer. Each node is an 8 vCPU / 16 GB VM. Two nodes is enough headroom for normal traffic; three gives us a node to drain for kernel patches and OS upgrades without touching capacity. The application is stateless behind the load balancer and runs the same Node.js service in each pool.
  • One primary Postgres (16 vCPU / 64 GB, dedicated NVMe), one read replica (same class) sitting behind a read-only DNS endpoint that the application uses for the heavy reporting queries and the dashboard’s analytical reads. Streaming replication, monitored, with the replica lag wired to PagerDuty.
  • One Redis (8 GB) for session cache, query cache, and the rate-limiting tokens. Persistence enabled. Sized for current working set plus a year of growth at observed rates.
  • A worker fleet — two VMs of the same size as an application node — running the batch enrichment jobs that had been Lambdas on AWS. Jobs are dispatched out of a Redis-backed queue and run inside systemd units with the right unit dependencies, logging, and retry policy.
  • Cloudflare in front for CDN, WAF, and DDoS. The free tier covers most of what this workload needs from a CDN; we put them on a paid plan for the WAF and the rate-limiting features the enterprise customers were asking about.
  • Backups: nightly Postgres logical dumps to encrypted Canadian object storage, plus continuous WAL archiving for point-in-time recovery to any minute in the prior seven days, monthly tier rolling for ninety days, quarterly tier rolling for two years. Restore drills quarterly against a randomly selected backup.

All of it sits in our Canadian regions. The application network is a private network between the application nodes, the database, and the workers — none of the application-tier traffic crosses the public internet, and there is no equivalent of the AWS NAT-gateway egress line because the architecture does not need one.

A representative slice of the Terraform we wrote, to give the texture rather than the specifics:

# infra/cloud-compute/web.tf
module "web_node" {
  source        = "../modules/cloud-compute"
  count         = 3
  name          = "app-${count.index + 1}"
  region        = "ca-central"
  size          = "c2-8-16"
  image         = "debian-12-base"
  private_net   = module.app_network.id
  cloud_init    = templatefile("${path.module}/cloud-init/app.yaml.tftpl", {
    redis_host  = module.redis.private_ip
    db_host     = module.postgres_primary.private_ip
    db_replica  = module.postgres_replica.private_ip
    role        = "web"
  })
  tags          = ["env:prod", "role:web", "patch:weekly"]
}

We picked sizes against measured load on the AWS side and added ~30% headroom. We did not buy three years of capacity in advance because nothing about this workload’s growth rate justifies it; the instances can be resized in place.

The migration

Twelve weeks. The shape of the plan looked the same as every parallel-build migration we run, with the schedule adjusted for the workload.

Weeks 1–3 were the audit, the proposal, and the topology design. The proposal we wrote included two versions: the rebuild we recommended, and a remediation-on-AWS path that would have cut the bill by an estimated 28% without leaving the platform. We were transparent that the remediation path was a real option and made financial sense if leaving AWS was off the table for non-technical reasons. They picked the rebuild after a week of CFO conversations.

Weeks 4–7 were the parallel build. Terraform for the network, the instances, the load balancer, and the database. Ansible for the application configuration, the systemd units, the backup scripts, and the monitoring agents. We stood the environment up empty, ran the same Node.js build artifacts the AWS environment was running, pointed the application at an empty Postgres, and ran the integration tests through it. Nothing was in front of customer traffic. Everything was reproducible from a clean Terraform state in under forty minutes.

The Lambdas were rewritten in this window. The daily enrichment job — the most expensive of the fifteen, and the one customers actually depended on — moved from a Lambda triggered by a CloudWatch rule at 03:00 UTC to a systemd timer with a unit file that looks like every other batch job we run:

# /etc/systemd/system/enrichment-daily.timer
[Unit]
Description=Daily customer enrichment batch

[Timer]
OnCalendar=*-*-* 03:00:00
Persistent=true
RandomizedDelaySec=300

[Install]
WantedBy=timers.target

The job itself runs under a systemd unit with a hard timeout, structured logging to journald, and a Prometheus textfile collector that emits the last-success timestamp and the row count. The runbook for “the enrichment job did not run” is fifteen lines and points at exactly three places to look. Two of the other fourteen Lambdas were absorbed into the same worker; four were the dead ones we deleted; the rest became queued jobs on the Redis-backed worker fleet.

Weeks 8–10 were data sync. Postgres on AWS was the source of truth. We set up logical replication from the AWS RDS primary to the Stack Harbor Postgres primary. The initial copy of the production database took twenty-six hours and ran in the background. Once the initial sync was done, the replication slot kept the new primary current within a few seconds of AWS through the rest of the build. S3 objects were synced with rclone in batches, with a final delta sync inside the cutover window. We ran the application against the replicated Postgres in shadow mode — read-only, no writes back to AWS, but exercising every read path the application uses in production — for a full week.

Week 11 was the dry-run cutover. We ran the cutover plan end-to-end against staging on a Wednesday evening. The DNS flip went smoothly. The application came up. The workers picked up the queue. We found one issue: the application was emitting X-Forwarded-For headers in a slightly different format because the new load balancer was a different product than the AWS ALB, and a handful of internal audit-log records were dropping the customer IP. We fixed it in fifteen minutes, redeployed, re-ran the cutover, and signed it off.

Week 12 was the real cutover. Sunday, 02:00 ET. We put the AWS environment into a read-only window — a feature flag the application supported, which made all write APIs return a 503 with a Retry-After of sixty seconds. The final logical replication delta was applied. We promoted the Stack Harbor Postgres to primary, broke the replication, and pointed the application’s DATABASE_URL at the new endpoint. DNS for the API and the dashboard flipped, with a TTL we had pre-staged at sixty seconds. The application’s write path opened up against the new primary.

Measured read-only window: eleven minutes. Zero data loss. We held the AWS environment in a frozen-but-running state for seventy-two hours as the rollback option, then began the decommission. The final teardown of the AWS account was scheduled for week sixteen — we wanted a full month of operational data on the new environment before unwinding the safety net.

One thing took longer than we wanted. The Cloudflare WAF rules — specifically, the rate-limiting rules — needed a week of tuning against real traffic before we got the false-positive rate down to something the support team was comfortable with. We had budgeted three days. We spent eight. The traffic pattern was bursty in a way the synthetic load tests had not captured. That is a normal part of putting a WAF in front of a real workload; we should have budgeted for it. We told the client we should have budgeted for it.

What landed at 90 days

The metrics in the block at the top of this page are the ninety-day measurements, taken against ninety days of pre-migration baselines from the same time of year. The context is below.

Infrastructure run-rate. Down 54%, including backups, monitoring, the Cloudflare paid plan, and the managed Cloud Compute operating fee. All-in 41% lower once the internal ops time the head of engineering’s team had been spending on AWS — chasing the Trusted Advisor recommendations they were never actioning, fielding the CFO’s monthly questions about the bill, reacting to the occasional CloudWatch alarm — is included.

Performance. p95 API latency 286 ms post-migration, down from p95 540 ms on AWS. The bulk of the improvement was not from the underlying hardware being faster; it was from the application no longer making cross-AZ round trips for every database read. On AWS, the application tier and the RDS primary lived in different availability zones for the multi-AZ guarantee, and the application’s chattier endpoints were making four to six database calls per request, each one crossing a zone boundary at sub-millisecond but non-zero latency. On the new environment, the application nodes and the Postgres primary share a network. The round trip is faster and consistently so.

Uptime. 99.97% across the ninety-day window. One incident: a kernel panic on one of the three application nodes at 04:18 ET on a Tuesday in week six. The load balancer drained it inside twenty seconds, the application served from two nodes until the node was replaced, the on-call engineer acknowledged in fourteen minutes, the replacement was up in nineteen, no customer visible impact. The post-incident note is two paragraphs and points at the kernel version that had the bug.

Tickets. Customer support tickets in the “the dashboard is slow” and “API timeout” categories dropped 39% versus the prior ninety-day window. The reduction is largely the latency improvement landing in the experience of the customers running the largest reporting queries.

Incident response. Sev-1 acknowledged response averaged 14 minutes across the window. The Sev-1 runbook chain is documented and the client’s head of engineering knows who is paged at every step. The client has not been woken up since cutover.

The deals. Three enterprise deals closed in the first quarter post-migration that had been gated on Canadian data residency. The Crown corporation we mentioned at the top closed in week eleven. The other two closed in weeks fourteen and eighteen. The CRO attributed all three saves to the residency answer they could now give in writing. The annual contract value across the three deals exceeded the entire engagement fee by a comfortable multiple. That comparison is the one we’d encourage CFOs to run before they treat infrastructure migration as a pure cost line.

What we’d say to a SaaS team thinking about this

Three things.

First, the question is not whether AWS is good — it is whether your workload is getting value out of the AWS-shaped overhead it is paying for. If your team is running a multi-region, serverless-first architecture that leans on Kinesis, DynamoDB, Step Functions, and a managed event mesh, the answer is probably yes and leaving will cost you in re-engineering what AWS gives you for free. If your team is running twenty EC2 instances, an RDS, a Redis, and fifteen Lambdas that could be cron jobs, the answer is probably no and you are paying for a service mesh you are not using. The audit is the way to find out which one you are.

Second, do not let “we have always been on AWS” be the reason. There is real switching cost, and it is fair to weigh it. There is also real switching cost in the opposite direction — staying on a platform that does not fit your workload — and it tends to be invisible in the way the bill is presented. The CFO question is the right question. Get to a clean answer for it.

Third, if you do leave, leave deliberately. Do not lift-and-shift twenty-two EC2 instances onto another provider’s twenty-two VMs. Use the move as the moment to simplify the topology you have outgrown and re-architect the pieces that were always meant to be temporary. Rebuilding is hard. Migrating without rebuilding ports the bill from one cloud to another and locks in the architecture decisions you were trying to get away from.

We wrote a longer companion piece on the audit methodology — Why your AWS bill keeps climbing — a senior operator’s audit — for teams who want to run the first cut of this on their own account before they call us. If you want a hand running it, that is what we do.


This is an example scenario: an illustrative engagement that shows how we approach this kind of work. It does not describe a specific client, and its figures are illustrative.

Considering a similar migration? Read about Cloud Compute and our Migration practice, or book a migration assessment.

Tell us what you're running. We'll tell you what needs to change.

Book a consult with Stack Harbor. We will review your current environment, risk points, support needs, and the best path forward.