Client Since 2020 · migration, multi-tenancy and console in 2026
A new client means new infrastructure. It switches on from here.
A Rails and Vue app started in 2020 was running on a shared cluster in an old AWS account. I moved it to a dedicated account with infrastructure as code and made it white-label: every client has their own database, service and domain, created from one console.
Resources per client
10
created by one call, from the database to the alarms
Alarms per client
4
CPU, memory, reachable tasks, 5xx errors
Canary first
1
test client updated and checked before the others
Tests
96
RSpec files, plus smoke tests on every client
The ask
Move the app to an AWS account of its own, make it multi-tenant with one service and one database per client, and give the operator a console to create, update, pause and measure every client.
Client: confidentialName: Rilevo is a made-up nameMy part: migration, multi-tenancy, console, redesign and the 2026 featuresCommits: 491 of the 981 since 2020 are mine
What it does
The features, one per row.
7
- 01
New tenant, one form
ID, name, admin and local-admin email, custom domain, logo and colours. Save, the card goes from “Creating” to “Active”, and both admins get an email to choose a password. The plan is set afterwards, from the same console.
- 02
What switches on
A dedicated Postgres database, the parameter holding its connection string, a log group, a Fargate task definition carrying the client’s theme, migrate and seed in a one-off task, a target group and load-balancer rule, the ECS service with automatic rollback, the DynamoDB record and four CloudWatch alarms.
- 03
The client’s own domain
If the client wants their own address, the certificate is requested automatically; the DNS records to add show up in the console, with a “Verify DNS” button.
- 04
One client at a time
Every push builds an image. The canary client goes first, with smoke tests and a full functional flow; if it fails, nobody else is touched. Then the rest, one at a time: a checked migration, a rolling update, a wait until the service is stable.
- 05
Pause, resume, backup, delete
Paused, the service drops to zero tasks and visitors see a “service suspended” page. Database backup on demand. Deleted clients move to a separate section.
- 06
Cost and status per client
What each client costs on AWS, its metrics, alarms, plan and expiry, all in the same console. More on it at the bottom of the page.
- 07
The clients’ app
Questionnaires in groups of questions, template databases that pass changes down to their children, statistics with AND/OR filters and Excel export, GDPR consent at sign-up. Name, logo and colour belong to each client.
Screens
Redrawn in the project’s own colours and fonts, with sample data.
How it’s built
The choices that matter, with the stack alongside.
Provisioning by API, not by pipeline
The console calls a Lambda, which invokes another that creates resources with the AWS SDK. CDK only builds the shared parts: network, cluster, database, DNS, cron.
API Gateway, Lambda, AWS SDK, DynamoDB
One service per client
Each client runs a Fargate service with 256 CPU units and 512 MB, a host rule on the load balancer and a subdomain covered by a wildcard record.
ECS Fargate, ALB, Route 53, ACM
Separate databases, one instance
One database per client on the same RDS instance, with seven-day backups. Data never mixes and the cost stays low.
RDS Postgres, SSM, Secrets Manager
No more Redis
Sidekiq and Redis replaced by Lambda crons. The daily notification cron calls each active client’s app.
EventBridge, Lambda
How it ships
The checks that exist on this project.
Why a made-up name
The real product carries the client’s name, which stays confidential together with its tenants. The screens are redrawn with sample data: names, numbers and costs are invented, and no real data appears here.
The console, day to day
Creating a tenant takes a minute. The rest of the time the console is there to tell you how things stand: what needs a look, what each client costs on AWS, what is switched on and what isn’t.
5
- 01
First, what needs you
The page opens with one sentence: “Nothing needs you”, or how many things do and how many can wait. The list sits right below, and each row takes you to where the problem gets fixed: a deploy or a creation that failed, a firing alarm, a plan that has run out or is about to, a domain still waiting for DNS, an error in the day’s checks.
- 02
The numbers
Running tasks against the ones requested, open alarms against the ones watched. For the shared parts, the database’s CPU, memory, disk and connections, plus load-balancer requests and errors over the last 24 hours. Every tenant has its own charts over 24 hours or 7 days (CPU, memory, requests, 5xx errors, p95 response time, reachable tasks) and reports its usage: projects against the plan’s limit, surveys filled in and completed, answers, users, pending requests.
- 03
AWS costs, split by tenant
Once a day a job pulls the bill from Cost Explorer and splits it. Anything carrying a tenant’s tag is that tenant’s; the rest (database, load balancer, network) is shared out by task-hours. You see this month so far with an end-of-month estimate, the last twelve months, where the money goes line by line, and what every tenant cost, month by month. In dollars, as AWS bills, with or without VAT.
- 04
The switches
Per tenant: pause and resume; suspend access, which shows everyone the suspended page and leaves the data alone; unlimited projects or a cap; the plan’s length, an extra period after expiry, and “Renew for 1 year”. Up top, Live turns the once-a-minute refresh on and off, Net or incl. VAT changes every figure, and any chart can be read as a table.
- 05
What’s on, and who checks it
Across the top of every tenant: Container Insights, the alarms in place, HTTPS on its own domain or waiting for DNS, the plan, tags carried onto tasks, and where its cost figure comes from. Four alarms per tenant and six on the shared parts, with no notifications: this is where you look. The daily checks put back any missing tag, and “Run checks” does it all again on the spot.
Cost Explorer, CloudWatch, Container Insights, DynamoDB, Lambda
Next: Aglioni · Pickup requests
Open