Search forkrail

Search documentation, comparisons, and CLI commands.

Spend limits and budgets

forkrail counts what each project costs as it’s spent and pauses a project the moment it reaches its budget, so a bug, a loop or a flood can’t run up your AWS bill.

Set a budget

Budgets are monthly, in dollars, for the calendar month in UTC. Every install has a team budget, which starts at $20; a project can also have its own, which counts toward both. Set them under team Settings → Spend Management, or:

forkrail spend show # the budgets, and what's paused
forkrail spend budget 200 # the team budget: $200 a month
forkrail spend budget 50 --project my-api # my-api's own budget
forkrail spend no-budget my-api # only the team budget applies to it again
forkrail spend exempt my-dashboard # keeps running when the team budget is reached

While nobody has set the team budget, a month that ends at 90% or more of it raises the next month’s a step, so a growing site isn’t paused by the starting value.

What’s counted

Spend is counted at AWS’s list price, in the units AWS bills, every few seconds. Free tier allowances aren’t taken off, since they belong to the whole account, so the figure errs high.

  • Function time at the function’s memory, start-up included, and each invocation.
  • Bytes to and from visitors, as the router counted them on the wire.
  • Bytes between the routers and your functions, and between regions.
  • What your functions send to the internet themselves.
  • Builds, image resizes, warm-ups and S3 requests.

Fixed costs (the router, the analytics server, keys) aren’t in a budget: they’re known in advance and the same every month. Services your app calls with its own IAM role (a database, queues) aren’t seen either; the Usage page shows them from AWS’s bill.

What happens at a budget

Within about a second of reaching a budget (ten for spend in another region):

  • Every host of the project answers 503 DEPLOYMENT_PAUSED: no function runs and no file is served. At the team budget, that’s every project except those kept running with spend exempt.
  • Work in flight is stopped, and Lambda is told to refuse the project’s function (its reserved concurrency is set to 0).
  • No build of it starts.

Owners hear at 50%, 75% and 100% of each budget, then at each further 100%, and when a project spends more than 10% of its monthly budget in an hour. Each alert names what spent most: the kind of cost, the path and the client’s network. Alerts go to the dashboard’s bell, email if set up, and webhooks.

A second line of defence

A separate guard reads AWS’s own numbers every 5 minutes and pauses a project if the routers somehow didn’t. The installer also creates an AWS Budget of $150 a month that emails you, as a backstop for anything outside forkrail.

Resume a project

A paused project stays paused until someone resumes it, even when a new month starts. Raise the budget first: a project still at or over its budget is paused again within a second.

forkrail spend resume # every paused project
forkrail spend resume my-api # just my-api
forkrail spend resume --keep shop # all but shop (say, the one under attack)
forkrail spend pause my-api # pause by hand

Owners change budgets and pause or resume; everyone in the team can see them.

Differences from Vercel

On Vercel, Spend Management is a Pro plan setting that can pause production deployments when you reach an amount. On forkrail every install has a budget from the start, counted every few seconds; it pauses previews and production alike and stops work already in flight. It covers what your AWS resources cost, since there is no plan and no included usage.

New to forkrail? Install it in your AWS account and deploy your first app in about 20 minutes.
Quickstart