Sandaruwan Jayasundara home

AWS Cloud Architecture for Startups

"Just use AWS" isn't a strategy. The right infrastructure decision depends on your team size, traffic, and how much operational overhead you can afford — and it isn't always AWS on day one.

Sandaruwan Jayasundara · Updated October 23, 2026 · 7 min read

Choosing cloud infrastructure for a startup is a cost and complexity trade-off, not a technology preference. Here's the decision framework I use with early-stage teams.

In short: start on the simplest setup your team can run reliably, often a single VPS or a managed platform. Move to AWS when you need horizontal scaling, managed databases, or compliance guarantees, and when you do, use managed building blocks (ECS on Fargate, RDS, S3, CloudFront) defined in code, with budgets and alerts in place from day one.

Key takeaways

  • Infrastructure should match your traffic and team, not the architecture you hope to need.
  • On AWS, prefer managed services (Fargate, RDS, SQS) over self-managed servers.
  • Use separate AWS accounts for production and non-production, and define resources with infrastructure as code.
  • Set budgets, cost alerts, and log retention on day one; NAT gateways and data transfer surprise most teams.
  • Decide your acceptable data loss and downtime, then choose backups and Multi-AZ to match.

1. A Single VPS Is Often the Right Starting Point

For most pre-product-market-fit startups, a single well-configured VPS environment (Hetzner, DigitalOcean, or a small AWS EC2 instance) running Docker Compose is enough:

  • One server running app, database, and reverse proxy (Caddy or Nginx) with TLS
  • Automated backups and a documented restore process
  • Costs a fraction of a managed multi-service AWS setup
  • No premature investment in infrastructure you don't yet need
A $20/month VPS that's actually monitored and backed up beats an elaborate AWS architecture nobody has time to operate properly at 2 AM.

2. When to Move to AWS (or Equivalent Managed Cloud)

  • You need to scale horizontally across multiple instances behind a load balancer
  • Compliance or enterprise customers require specific infrastructure guarantees
  • You need managed databases (RDS), managed queues (SQS), or auto-scaling
  • Your team has grown enough to own infrastructure as a dedicated concern

3. Core AWS Architecture Building Blocks

  • ECS/Fargate for containerized services without managing raw EC2 fleets
  • RDS (PostgreSQL) for managed database with automated backups and read replicas
  • S3 + CloudFront for static assets and file storage with CDN delivery
  • Application Load Balancer for traffic distribution and health checks
  • CloudWatch for logs, metrics, and alerting

A reference architecture for a typical web product

For a SaaS product with a web frontend, an API, and background jobs, this layout covers a long stretch of growth:

  1. Edge: Route 53 for DNS, CloudFront (or Cloudflare) in front of everything, TLS certificates from ACM.
  2. Network: one VPC with public subnets for the load balancer and private subnets for application containers and the database.
  3. Compute: an ECS service on Fargate for the API behind an Application Load Balancer, and a second ECS service for workers.
  4. Async work: SQS queues between the API and workers for email, exports, and other slow tasks.
  5. Data: RDS PostgreSQL in a private subnet, ElastiCache Redis when caching is justified, S3 for files.
  6. Secrets and access: Secrets Manager or SSM Parameter Store, with an IAM task role per service.

In my current role, applications such as an HR system, an admin portal, and a RAG-based AI assistant are deployed on AWS, and these are the building blocks I reach for first. One cost detail to plan for: private subnets usually need a NAT gateway for outbound internet access, which has a fixed hourly charge plus data processing fees. VPC endpoints for S3 and other AWS services reduce that traffic.

Choosing compute

Option Good for Watch out for
EC2Full control, special workloads, lowest unit cost with commitmentsYou patch and manage the servers
ECS on FargateContainerized APIs and workers with steady trafficHigher per-unit price than EC2
LambdaEvent-driven tasks, spiky or low trafficCold starts, time limits, database connection limits
App Runner / Elastic BeanstalkSimple apps that want minimal setupLess flexibility as needs grow

A deeper comparison is in AWS ECS vs Lambda vs EC2.

4. CI/CD: Build It Before You Need It

Regardless of VPS or AWS, a CI/CD pipeline should exist from the first production deploy — GitHub Actions running tests, building a Docker image, and deploying on merge to main. Manual deploys are the single biggest source of "it worked on my machine" production incidents.

on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci && npm test
      - run: docker build -t app:${{ github.sha }} .
      - run: ./deploy.sh

For AWS deploys, let GitHub Actions assume an IAM role through OIDC instead of storing long-lived access keys as repository secrets. The pipeline itself is covered in more detail in DevOps for full stack developers.

Accounts, Environments, and Infrastructure as Code

  • Use AWS Organizations with at least separate production and non-production accounts, so a mistake in staging cannot touch production data.
  • Sign in through IAM Identity Center rather than long-lived IAM users, and enable MFA everywhere.
  • Define infrastructure with Terraform or AWS CDK from the start; console-built resources are hard to reproduce.
  • Turn on CloudTrail in every account so changes are auditable.

5. Security Baseline, Regardless of Scale

  • Secrets in a secrets manager or environment variables — never committed to git
  • Least-privilege IAM roles instead of broad admin credentials
  • Cloudflare in front of any public-facing app for DDoS protection and WAF rules
  • Automated OS and dependency patching on any self-managed VPS

The edge layer is covered in Cloudflare, WAF, and web application security. On AWS specifically, also block public access on S3 buckets by default and keep databases in private subnets with security groups that only allow the application.

6. Controlling AWS Costs

AWS bills are rarely high because of one big decision; they creep up through many small ones. The habits that keep them predictable:

  • Budgets and alerts in AWS Budgets on day one, with an alert well below the amount that would hurt.
  • Tags for environment and service on every resource, so Cost Explorer shows where money goes.
  • Log retention set on every CloudWatch log group; the default is to keep logs forever.
  • Network costs: watch NAT gateway processing and cross-AZ or internet data transfer.
  • Right-sizing instances and RDS based on actual utilization, and scheduling non-production environments to stop overnight.
  • Commitments (Savings Plans, reserved instances) only after usage has been stable for a few months.

7. Reliability: Decide What You Can Lose

Before paying for high availability, decide two numbers with the business: how much data you can afford to lose (recovery point objective) and how long you can be down (recovery time objective). A B2B tool used during office hours may accept an hour of downtime; a payment flow may not.

  • Enable RDS automated backups with point-in-time recovery, and test a restore.
  • Run at least two application tasks across two Availability Zones once you have paying customers.
  • Turn on RDS Multi-AZ when the cost of a database outage clearly exceeds the doubled instance cost.
  • Multi-region setups are rarely justified for startups; good backups and a documented recovery plan come first.

Bringing It Together

Right-sized infrastructure is a competitive advantage for a startup — it means engineering time goes into the product, not into managing complexity you don't need yet. I help teams choose and build the infrastructure that matches where they actually are, with a clear path to what's next.

Frequently Asked Questions

Should a startup use AWS from day one?

Not necessarily. Before product-market fit, a single well-run VPS or a managed platform is often cheaper and simpler. Move to AWS when you need horizontal scaling, managed databases and queues, or infrastructure guarantees that customers or compliance require.

What is a good AWS architecture for a small SaaS product?

A common setup is CloudFront and Route 53 at the edge, an Application Load Balancer in public subnets, ECS on Fargate for the API and workers in private subnets, SQS for background jobs, RDS PostgreSQL for data, S3 for files, and Secrets Manager for credentials.

Should I use ECS, Lambda, or EC2?

ECS on Fargate suits containerized APIs and workers with steady traffic. Lambda suits event-driven or spiky workloads. EC2 gives full control and the lowest unit cost with commitments, but you manage the servers yourself.

How can a startup keep AWS costs under control?

Set AWS Budgets alerts on day one, tag resources by environment and service, set CloudWatch log retention, watch NAT gateway and data transfer charges, right-size instances, stop non-production environments overnight, and buy Savings Plans only once usage is stable.

Do I need Multi-AZ or multi-region on AWS?

Decide your acceptable data loss and downtime first. Most startups should run application tasks across two Availability Zones and enable RDS backups with point-in-time recovery; RDS Multi-AZ is worth it once a database outage costs more than the extra instance. Multi-region is rarely justified early.

I'm Sandaruwan Jayasundara — Senior Software Engineer | Cloud & DevOps. See DevOps for full stack developers or get in touch about your infrastructure. For how infrastructure decisions fit each product stage, see from MVP to SaaS: a founder's guide.

Related articles

Need help with your project?

I take on a limited number of remote engagements. Explore my services or get in touch.

Contact Sandaruwan