NewsCrawler.org

Migrating an internal app from ECS + RDS to Lambda + Aurora DSQL cut infra costs to nearly zero

ECS + RDS → Lambda + Aurora DSQL の移行で社内アプリのインフラ費用がほぼゼロになった話
Image: zenn.dev

An engineer interning at WOGO describes migrating a small internal Slack-linked business app from ECS + RDS in a VPC to Lambda + Aurora DSQL. The old setup, inherited from a company Terraform template, carried fixed monthly costs of about $208 even with almost no traffic. The largest items were a NAT Gateway at $45.26/month, VPC endpoints at $61.32 per month (two endpoints for ECR and one for Secrets Manager across two Availability Zones), ALB at $17.74, and a db.t3.micro RDS instance at $20.44. Usage-based charges were under $1 per month, so the fixed costs dominated.

The new architecture uses Lambda behind a Function URL with Lambda Web Adapter and Aurora DSQL, which is reached over IAM authentication at an AWS-managed endpoint, so no VPC, NAT Gateway, ALB, or VPC endpoints are needed. Aurora DSQL was chosen for its PostgreSQL compatibility (Prisma usage mostly carried over, with changes limited to type definitions, primary keys, and foreign key constraints) and its pay-per-use billing in DPU. Constraints include transaction limits of 3,000 rows and 10 MiB in 5 minutes, Repeatable Read isolation with optimistic concurrency, no triggers, PL/pgSQL, temp tables, TRUNCATE, or CREATE TYPE, and connections cut off after 1 hour. Shared RDS was rejected because rebuilding the database for one app would affect the others sharing it.

With roughly 30,000 requests per month, Lambda costs about $0.13 and DSQL about $0.6 — but free tiers (100,000 DPU, 1 million requests, 400,000 GB-seconds) make the usage charges $0, leaving only a few cents of storage monthly. Annual cost drops from about $2,400 to a few dollars. Password rotation via Secrets Manager and daily container redeploys were also eliminated.

Read the original zenn.dev

Sources

  • Zenn JA

    ECS + RDS → Lambda + Aurora DSQL の移行で社内アプリのインフラ費用がほぼゼロになった話

    18 likes3 bookmarks1 comment

Terms

  1. VPC endpoint — A paid connection that lets resources inside a VPC reach AWS services without traffic leaving the VPC over the internet.
  2. Aurora DSQL — A serverless, distributed AWS PostgreSQL-compatible database billed per DPU and storage, accessed via an AWS-managed endpoint instead of a cluster inside your VPC.
  3. DPU — Distributed Processing Unit, the billing unit of Aurora DSQL, covering reads (ReadDPU), writes (WriteDPU) and CPU time (ComputeDPU); the Tokyo region price is $10 per 1 million DPU.
  4. NAT Gateway — A managed component that lets containers in private subnets reach the internet, billed hourly whether or not traffic flows.

Published: First seen: Читать по-русски

Open as a page