Run managed cloud applications without billing surprises

By Kate Baker
Run managed cloud applications without billing surprises

Managed cloud applications promise a simple trade: you write the code, and someone else handles the servers, patches, backups and scaling. For a solo founder that trade is usually worth it. The part that often goes wrong is not the operations, it is the invoice. A platform that scales automatically will also bill automatically, and without clear limits the first sign of a problem can be a charge several times larger than you planned for.

This article explains what "managed" actually covers, why some pricing models produce surprises, how to evaluate a provider before you move, and a practical plan to migrate a Dockerized app and its Postgres database in an afternoon.

What managed cloud applications actually are

A managed cloud application is software you run in the cloud where a third party takes responsibility for some or all of the operational layer: provisioning, OS and runtime patching, networking, TLS, monitoring, backups and scaling. You keep responsibility for the application itself.

The word "managed" covers a wide range. A useful way to see it is a responsibility split:

LayerSelf-managed VPSContainer platform (PaaS)Fully managed service
Application codeYouYouProvider (SaaS)
Runtime and dependenciesYouYou (via Dockerfile or buildpack)Provider
OS patching and security updatesYouProviderProvider
TLS certificates, load balancingYouProviderProvider
Database backups and failoverYouProvider (if managed DB)Provider
ScalingYouProvider, within your limitsProvider
Cost controlYouSharedProvider's pricing

Most founders shipping a first SaaS sit in the middle column: they bring a container or a Git repository, and the platform runs it together with managed databases and storage. That is the model this article focuses on.

Note the last row. Operations can be handed off. Cost control is always shared, because the provider sets the pricing model but only you decide what you deploy and how it behaves under load.

Why managed platforms produce surprise bills

Surprise bills rarely come from dishonest pricing. They come from a mismatch between the pricing model and how the team thinks about cost. Four patterns cause most of them.

Usage-based compute with no ceiling

Many platforms bill compute by resource consumption over time, for example per vCPU-second and per GB of RAM per hour. This is fair and efficient, but it means cost is a function of behavior, not configuration. A memory leak, an infinite retry loop or a background job that never idles all turn directly into money.

A simple way to reason about it:

monthly compute ≈ (average vCPU used × vCPU price × hours)
                + (average RAM GB used × RAM price × hours)

If "average vCPU used" doubles because of a bug, the bill doubles, and you find out at the end of the month.

Autoscaling without limits

Autoscaling protects availability, but an unbounded maximum replica count means a traffic spike, a crawler or a load test can multiply your running instances. Always check whether you can set a maximum, not just a minimum.

Per-environment and per-service multiplication

Preview environments per pull request, a staging copy of every service, a separate worker, a cron container: each may be billed as its own service. Five services with a small base charge each can cost more than one larger instance.

Metered add-ons

Egress bandwidth, database storage growth, backup retention, log retention and build minutes are frequently billed separately. None of them is large alone. Together they are the difference between the price you expected and the price you paid.

A useful test: if you cannot write down next month's bill on paper before deploying, within a margin you are comfortable with, the pricing model is not predictable enough for your stage.

How to evaluate a managed provider before moving

Before migrating anything, answer these questions for each provider you are considering. They take an hour and prevent most bad decisions.

  1. Can I compute the monthly cost in advance? Look for a fixed plan price and a clearly stated amount of included resources or credits.
  2. What happens when I exceed the included amount? Overage billing, throttling or a hard stop? Each is valid, but you need to know which.
  3. Are there spending alerts or caps? Alerts at 50%, 80% and 100% of a budget are the minimum.
  4. Are backups included for the managed database? How often, how long are they retained, and can you restore them yourself?
  5. How many services does my app become? Count web, worker, cron, database and storage, and price each.
  6. Who else can access the dashboard? If a non-engineer co-founder needs to check status or trigger a redeploy, per-seat pricing matters.
  7. How do I leave? Standard Docker images, standard Postgres and S3-compatible storage keep your exit cheap.

The seventh question is the one most often skipped. A managed platform built on standard formats is a decision you can reverse. One built on proprietary runtimes and data formats is not.

Prepare your application for a managed platform

Managed platforms work best with applications that follow the long-standing twelve-factor principles. Most Dockerized apps are close already. Check these five items before moving.

1. Configuration comes from environment variables

No hardcoded hostnames, no config.prod.json baked into the image:

// config.ts
const required = ["DATABASE_URL", "SESSION_SECRET", "S3_BUCKET"] as const;

for (const name of required) {
  if (!process.env[name]) {
    console.error(`Missing required env var: ${name}`);
    process.exit(1);
  }
}

Failing fast at startup turns a confusing runtime error into a clear deploy failure.

2. The container is stateless

Anything written to the local filesystem disappears on redeploy and is not shared between replicas. User uploads belong in object storage, sessions in the database or a cache.

3. It listens on the port it is given

ENV PORT=3000
EXPOSE 3000
CMD ["node", "dist/server.js"]
app.listen(Number(process.env.PORT ?? 3000), "0.0.0.0");

Binding to 0.0.0.0 rather than localhost is required inside a container.

4. It logs to stdout and stderr

Platforms collect container output. Log files inside the container are invisible to them.

5. It has a health endpoint

app.get("/healthz", async (_req, res) => {
  try {
    await db.query("SELECT 1");
    res.status(200).send("ok");
  } catch {
    res.status(503).send("db unavailable");
  }
});

A health check that verifies the database lets the platform stop routing traffic to a broken instance instead of serving errors.

Migrate the database without losing data

The database is the part of a migration that deserves the most care. For Postgres, the standard approach for small and medium databases is a logical dump and restore.

Step 1: take a dump in custom format

pg_dump --format=custom --no-owner --no-privileges \
  --dbname="$OLD_DATABASE_URL" \
  --file=app.dump

The custom format (-Fc) is compressed and lets pg_restore run in parallel. --no-owner and --no-privileges avoid errors when role names differ on the new server.

Use a pg_dump version equal to or newer than the source server's major version.

Step 2: restore into the managed database

pg_restore --no-owner --no-privileges --jobs=4 \
  --dbname="$NEW_DATABASE_URL" \
  app.dump

Step 3: verify

Compare row counts for your most important tables on both sides:

SELECT 'users' AS t, count(*) FROM users
UNION ALL SELECT 'orders', count(*) FROM orders
UNION ALL SELECT 'subscriptions', count(*) FROM subscriptions;

Also check extensions (SELECT extname FROM pg_extension;). A missing extension such as pgcrypto or uuid-ossp is the most common restore failure.

Keep the write gap small

Writes that happen between the dump and the cutover are lost unless you stop them. For a beta-stage app the simplest solution is a short maintenance window: put the app in read-only or maintenance mode, dump, restore, switch, and reopen. For a database of a few gigabytes this usually takes minutes, not hours.

A migration plan for one afternoon

Here is the full sequence in order, assuming a web service, a worker and Postgres.

  1. The day before: lower the DNS TTL on your domain to 300 seconds so the cutover propagates quickly.
  2. Create the services on the new platform from your repository or Docker image, with all environment variables set except DATABASE_URL.
  3. Create the managed database and note its connection string.
  4. Deploy once against an empty database and run migrations to confirm the build and connection work.
  5. Enable maintenance mode on the old environment.
  6. Dump, restore and verify as described above.
  7. Point DATABASE_URL at the new database and redeploy.
  8. Smoke test using the platform's default URL: sign in, create a record, upload a file.
  9. Switch DNS to the new platform and wait for the TTL.
  10. Keep the old environment stopped but intact for a week. That is your rollback plan.

Write the rollback steps down before you start: which DNS record to revert, and which database to point back to. You will almost certainly not need them, and they are much easier to write while calm.

Keeping costs predictable after the move

Migration solves the immediate problem. These habits keep it solved:

  • Set a monthly budget and alerts in the provider's dashboard on day one.
  • Cap autoscaling at a maximum you can afford during a spike.
  • Review services monthly. Delete preview environments and idle workers.
  • Test a restore once a quarter. A backup you have never restored is an assumption, not a backup.
  • Document a hotfix path a co-founder can follow without you: where to see the deploy status, how to roll back to the previous deploy.

Running managed cloud applications on Granite.so

Granite.so is built around the middle column of the table above. You deploy from a Git repository, with automatic builds on every push, or from a Docker image. Managed databases with automatic backups and S3-compatible storage with a CDN sit on the same platform, so the migration plan above involves one provider instead of three. Automatic scaling handles traffic increases without manual server work.

Pricing is plan-based: the Hobby plan is $9/month and includes $15 of monthly usage credits, and the Advanced plan is $39/month for production workloads. That makes it possible to answer question 1 from the evaluation list before you deploy. It is still worth setting alerts and reviewing usage monthly, as with any platform. Team access means a non-engineer co-founder can check status or trigger a redeploy without sharing your login.

Summary

  • Managed cloud applications move operations to a provider, but cost control remains shared.
  • Surprise bills come from usage-based compute without ceilings, unbounded autoscaling, service multiplication and metered add-ons.
  • Evaluate providers on whether you can predict the bill in advance and leave cheaply later.
  • Prepare the app with environment-based config, statelessness, stdout logging and a real health check.
  • Migrate Postgres with pg_dump -Fc and pg_restore, verify row counts and extensions, and keep a rollback path.

If you want to run your Dockerized app, database and storage on one plan with a known monthly price, you can start on Granite.so and follow the migration plan above this weekend.

Keep reading

More posts tagged “Community”.
Be first in line for updates
and special pricing
Get early access to new features and exclusive discounts delivered straight to your inbox