Cloud infrastructure that grows with the business

A practical order of work: start small, write it down as code, fix the database first, and keep the bill predictable.

Cloud infrastructure rarely fails because it could not handle a million users. It fails because nobody can remember how it was set up, a bill arrives that nobody predicted, or a single database turns out to have no working backup. Building for growth mostly means removing those risks early, in a sensible order.

Start smaller than you think

A new product does not need a container orchestration platform. A managed application service, a managed database and object storage will carry most products a long way, and they leave patching, failover and backups to the provider. Every component you run yourself is a component someone has to keep running at three in the morning.

Choose the region closest to most of your users, and check whether your data is required to stay in a particular country before you choose.

Write the infrastructure down as code

Anything created by clicking in a console will eventually be forgotten or recreated wrongly. Describing infrastructure in code, with a tool such as Terraform or your provider’s own equivalent, gives you a reviewable history of every change and a way to build an identical staging environment.

  • Keep the definitions in version control and change them through review, like application code.
  • Use the same definitions for staging and production, with different sizes and names.
  • Keep secrets out of the repository. Use the provider’s secret store and give each service access only to its own.

Make the application stateless

The single most useful property for scaling is that any copy of the application can handle any request. That means no user sessions held in memory and no files written to the local disk. Sessions go in a shared store, uploads go to object storage, and scheduled jobs are designed so that two copies running at once do not do the work twice.

Once that is true, handling more traffic is a matter of running more copies behind a load balancer, and replacing a broken copy loses nothing.

The database is where scaling gets hard

Application servers are easy to multiply. The database is not, so it deserves most of the attention.

  • Look at slow queries first. A missing index is the most common cause of a slow system, and fixing it costs nothing.
  • Use a connection pool. Many application copies each opening their own connections will exhaust a database long before its CPU is busy.
  • Add a read replica when reads dominate, and send reports and exports there.
  • Cache results that are expensive and change rarely, and decide in advance how each cached item gets refreshed.
  • Move slow work, such as sending email or generating a document, onto a queue so the request can finish quickly.

Splitting a database across several servers is a last resort. Most systems that believe they need it have a query or a data-model problem instead.

Know what is happening

You cannot scale what you cannot see. Before traffic grows, make sure three things exist: logs from every service in one searchable place, metrics for response time, error rate and resource use, and alerts that reach a person.

Alert on what users experience, such as error rate and slow responses, more than on machine statistics. A server at ninety percent CPU that is answering quickly is not an emergency. A service returning errors at ten percent CPU is.

Backups and recovery

A backup that has never been restored is a hope, not a backup. Schedule automatic backups, keep copies in a second location, and practise restoring into a fresh environment. Decide two numbers with the business: how much recent data it could bear to lose, and how long it could bear to be offline. Those two numbers decide how much to spend.

Security basics that are cheap early

  • Give every service and person the least access that lets them do their job.
  • Keep databases off the public internet; let only the application reach them.
  • Require two-factor sign-in on the cloud account, and do not use the root account for daily work.
  • Encrypt data in transit and at rest; managed services make this a setting.
  • Record who changed what, and keep those records somewhere the same people cannot delete them.

Keep the bill predictable

Cloud cost grows quietly. Tag resources by project and environment so the bill can be read. Set a budget alert on the first day. Review the largest items monthly: an oversized database, storage nobody reads, staging environments left running overnight, and data-transfer charges are the usual surprises.

Automatic scaling helps only when it also scales down, and committed-use discounts are worth taking only for capacity you are sure to need for the whole term.

A reasonable order of work

  • Managed services, infrastructure as code, automatic backups and a budget alert.
  • A stateless application behind a load balancer, with logs and basic alerts.
  • Query tuning, connection pooling, caching and a queue for slow work.
  • Read replicas, a CDN for static files, and a rehearsed recovery.
  • Multiple zones or regions, when the cost of downtime justifies it.

Each step is taken when a measured problem calls for it. Infrastructure built ahead of need costs money every month and adds things that can break.