Back to Consulting
Cloud ArchitectureCost OptimizationDigitalOcean

Cloud Infrastructure Setup for Startup

Published on May 10, 2024

Overview

A SaaS startup approached us with an urgent problem: their manually configured cloud servers were costing $4,000/month, were prone to outages during peak traffic, and had no disaster recovery plan. They needed a professional, scalable infrastructure before their Series A fundraise.

Assessment

We started with a 2-week assessment covering:

  • Current architecture review: Identified 6 underutilized VMs running at < 15% CPU average
  • Cost analysis: Found $1,800/month in waste from over-provisioned resources
  • Risk analysis: Single points of failure in database and load balancer layers
  • Compliance gaps: No automated backups, no monitoring, no alerting

Our Solution

Infrastructure Design

We designed a new architecture using Infrastructure as Code (IaC) with OpenTofu:

┌─────────────────────────────────────────────┐
│               Cloudflare CDN                │
└──────────────────┬──────────────────────────┘
                   │
┌──────────────────▼──────────────────────────┐
│         Load Balancer (DigitalOcean)        │
└────────┬──────────────────────┬─────────────┘
         │                      │
┌────────▼────────┐   ┌─────────▼───────────┐
│   App Server 1  │   │   App Server 2      │
│  (Auto-scaled)  │   │  (Auto-scaled)      │
└────────┬────────┘   └─────────┬───────────┘
         └──────────┬───────────┘
                    │
┌───────────────────▼──────────────────────────┐
│        Managed PostgreSQL (HA Cluster)       │
│        Primary + 1 Standby Replica          │
└──────────────────────────────────────────────┘

Key Changes

  1. Right-sized compute: Replaced 6 VMs with 2 auto-scaling droplets — handles 3x the traffic at half the cost
  2. Managed database: Migrated from self-managed PostgreSQL to DigitalOcean Managed PostgreSQL with automatic failover
  3. CDN & caching: Added Cloudflare CDN to cache static assets, reducing origin load by 60%
  4. Automated backups: Daily database snapshots with 14-day retention; weekly infrastructure snapshots
  5. Monitoring stack: Prometheus + Grafana for metrics, PagerDuty for on-call alerting

IaC with OpenTofu

All infrastructure is defined as code, enabling:

  • Reproducible environments (staging mirrors production exactly)
  • Infrastructure changes reviewed via pull requests
  • One-command disaster recovery to a new region

Results

| Metric | Before | After | |--------|--------|-------| | Monthly Cost | $4,000 | $2,350 | | Uptime (30-day) | 97.2% | 99.95% | | Avg. Response Time | 850ms | 210ms | | Deployment Time | Manual (2 hrs) | Automated (8 min) | | Recovery Time Objective | Unknown | < 15 minutes |

Cost reduction: 41% — saving $19,800 per year.

Outcome

The client successfully closed their Series A round. The investor due diligence team specifically noted the professional infrastructure setup as a confidence factor. The startup has since scaled to 3x users with no additional infrastructure changes needed.