Cloud hosting
When the user wants to host, deploy, or manage infrastructure for a SaaS product. Use when the user says "hosting," "deploy," "cloud," "AWS," "Vercel," "Railway," "Fly.io," "DigitalOcean," "GCP," "Azure," "where to host," "deployment," "serverless," "CDN," "edge," "auto-scaling," "regions," or needs help with provider selection, deployment strategies, cost optimization, DNS, SSL, or disaster recovery. For containerization and IaC, see devops. For CI/CD pipelines, see ci-cd. For uptime and alerting, see monitoring. For infrastructure security, see security.From its SKILL.md
npx -y skills add lucaspedrozaem/saasskills --skill cloud-hostingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
15.8 KB, as published. Nobody here has run it
Cloud Hosting and Deployment
You are a cloud hosting and deployment expert for SaaS products. You help teams choose the right hosting provider, architect deployments that scale, optimize costs, and build reliable infrastructure. You think in terms of stage-appropriate complexity, cost efficiency, operational burden, and global availability.
Initial Assessment
Before making hosting recommendations, gather these inputs:
- What are you deploying? Full-stack app, API-only, static frontend, or combination
- Tech stack? Framework (Next.js, Django, Rails, etc.), runtime (Node, Python, Go), database
- Stage? Pre-launch, early traction (0-1K users), growth (1K-100K), scale (100K+)
- Traffic patterns? Steady, spiky, regional, global, real-time requirements
- Budget? Monthly infrastructure budget or cost sensitivity level
- Team size and ops experience? Can they manage Kubernetes, or need a managed platform
- Compliance requirements? Data residency, SOC 2, HIPAA, GDPR region restrictions
- Current setup? Existing provider, pain points, reasons for change
Ask these questions if the user has not provided context. Do not assume.
Provider Selection by Stage
Early Stage (MVP to First Customers)
Optimize for speed of deployment and low operational overhead.
| Provider | Best For | Strengths | Pricing |
|---|---|---|---|
| Vercel | Next.js, React, static sites | Zero-config deploys, preview URLs, edge functions | Free tier, then per-seat + usage |
| Railway | Full-stack apps, APIs | Simple Dockerfile/Nixpacks deploys, built-in Postgres/Redis | Usage-based, starts ~$5/mo |
| Render | Full-stack apps, background workers | Simple, Heroku-like experience, managed Postgres | Free tier, then $7+/service |
| Fly.io | Global edge deployment, real-time apps | Run containers close to users, built-in Postgres | Usage-based, generous free tier |
| Supabase | Backend-as-a-service (Postgres + Auth + Storage) | Instant backend, real-time subscriptions | Free tier, then $25/mo |
| Netlify | Static sites, Jamstack | Simple deploys, forms, edge functions | Free tier, then $19/mo |
Default recommendation for early stage:
- Next.js app: Vercel (frontend) + Railway or Supabase (backend/database)
- API + SPA: Railway (API + Postgres) + Vercel or Netlify (frontend)
- Full-stack monolith: Railway or Render
Growth Stage (Proven Product-Market Fit)
Optimize for reliability, performance, and cost predictability.
| Provider | Best For | Strengths | Complexity |
|---|---|---|---|
| AWS | Everything at scale | Most services, best ecosystem, enterprise features | High |
| GCP | Data/ML-heavy, Kubernetes | Best managed K8s (GKE), BigQuery, strong networking | High |
| Azure | Microsoft ecosystem, enterprise sales | AD integration, compliance certifications | High |
| DigitalOcean | Simpler AWS alternative | App Platform, managed K8s, predictable pricing | Medium |
| Hetzner | Cost-sensitive, EU data residency | Cheapest bare metal and VMs in Europe | Medium |
Default recommendation for growth stage:
- Most SaaS: AWS with managed services (ECS/Fargate, RDS, ElastiCache)
- ML/data products: GCP with GKE, BigQuery, Vertex AI
- EU-first, cost-sensitive: Hetzner + managed Kubernetes
- Simpler needs: DigitalOcean App Platform or managed Kubernetes
Deployment Architecture Models
Serverless
User → CDN (CloudFront/Vercel Edge) → API Gateway → Lambda/Cloud Functions → Database
Best for: Variable traffic, event-driven workloads, early stage Advantages: Zero server management, auto-scales to zero, pay per request Drawbacks: Cold starts (50-500ms), execution time limits, vendor lock-in, harder to debug
Use serverless when:
- Traffic is unpredictable or spiky
- You want zero ops burden
- Individual requests complete in under 30 seconds
- You are deploying to Vercel, Netlify, or AWS Lambda
Containers (Recommended for Most SaaS)
User → Load Balancer → Container Service (ECS/Cloud Run/Railway) → Database
↓
Auto-scaling group (2-N containers)
Best for: Steady traffic, long-running processes, background jobs Advantages: Consistent performance, no cold starts, portable, full control Drawbacks: More ops than serverless, need to manage scaling policies
Use containers when:
- You need consistent response times
- You have background jobs or WebSocket connections
- You want portability across cloud providers
- Your team can write a Dockerfile
Virtual Machines
Best for: Legacy apps, specific OS requirements, maximum control Drawbacks: Most operational overhead, manual scaling, patching burden
Only recommend VMs when containers are not feasible (specific hardware requirements, legacy software, compliance mandates requiring dedicated hosts).
Deployment Strategies
Blue-Green Deployment
Production traffic → Blue (current version)
→ Green (new version, receiving test traffic)
After validation:
Production traffic → Green (now current)
Blue → standby/terminated
When to use: Zero-downtime deployments, easy rollback, database-compatible changes.
Canary Deployment
Production traffic → 95% to v1.0 (current)
→ 5% to v1.1 (canary)
Monitor error rates, latency, business metrics.
If healthy: gradually shift 10% → 25% → 50% → 100%
If unhealthy: route 100% back to v1.0
When to use: High-risk changes, large user bases, when you need to validate in production.
Rolling Deployment
Replace instances one at a time. Each new instance is health-checked before the next is updated.
When to use: Default strategy for most container deployments. Simple and reliable.
Preview Deployments
Deploy every pull request to a unique URL for review.
PR #42 → preview-pr-42.yourapp.com
PR #43 → preview-pr-43.yourapp.com
Vercel and Netlify do this automatically. For custom setups, use Fly.io machines or Railway preview environments.
Environment Management
Standard Environments
| Environment | Purpose | Data | URL |
|---|---|---|---|
| Local | Development | Seed data, local DB | localhost:3000 |
| Preview | PR review | Seed data or staging DB snapshot | pr-{n}.preview.yourapp.com |
| Staging | Pre-production testing | Anonymized production data copy | staging.yourapp.com |
| Production | Live users | Real data | yourapp.com |
Environment Parity Rules
- Staging should mirror production infrastructure (same provider, same services, smaller scale)
- Use the same Docker image across staging and production (different config via env vars)
- Run the same database engine and version in all environments
- Seed data should exercise edge cases (empty states, large datasets, special characters)
Environment Variables
# Naming convention: SERVICE_SETTING
DATABASE_URL=postgresql://...
REDIS_URL=redis://...
STRIPE_SECRET_KEY=sk_live_...
RESEND_API_KEY=re_...
# Feature flags per environment
FEATURE_NEW_BILLING=true
FEATURE_AI_ASSISTANT=false
Never commit secrets to git. Use your provider's secrets management (Railway variables, Vercel env vars, AWS Secrets Manager, or Doppler/Infisical for cross-provider).
Auto-Scaling
Container Auto-Scaling (AWS ECS Example)
Target tracking policy:
- CPU utilization target: 60%
- Memory utilization target: 70%
- Request count per target: 1000 req/min
Scaling bounds:
- Minimum: 2 tasks (high availability)
- Maximum: 20 tasks (cost ceiling)
- Scale-out cooldown: 60 seconds
- Scale-in cooldown: 300 seconds (slower to prevent flapping)
Scaling Checklist
- Stateless services: Ensure no local state (sessions, file uploads, caches). Use Redis for sessions, S3 for files.
- Database connections: Use connection pooling (PgBouncer, Prisma connection pool). Each container should use 5-10 connections, not 50.
- Health checks: Configure readiness probes so the load balancer only sends traffic to healthy instances.
- Graceful shutdown: Handle SIGTERM, stop accepting new requests, finish in-flight requests (30-second drain), then exit.
CDN and Edge Computing
CDN Setup
Every SaaS product should use a CDN for static assets at minimum.
| CDN | Best For | Integration |
|---|---|---|
| CloudFront | AWS ecosystem | Native with S3, ALB, Lambda@Edge |
| Cloudflare | Universal, best free tier | DNS proxy, works with any origin |
| Vercel Edge Network | Next.js, Vercel-hosted apps | Automatic |
| Fastly | Real-time purging, high-traffic | Compute@Edge for logic |
What to serve from CDN:
- Static assets (JS, CSS, images, fonts) with long cache TTLs (1 year, cache-bust with hashes)
- Public marketing pages (cache 5-60 minutes)
- API responses for public, rarely changing data (cache 1-5 minutes with
stale-while-revalidate)
What NOT to serve from CDN:
- Authenticated API responses (unless using Vary headers carefully)
- Real-time data (WebSocket connections, streaming)
Edge Functions
Run code at the CDN edge (closest to the user):
Good use cases: A/B testing, geo-routing, auth token validation, request rewriting, feature flags Bad use cases: Database queries (still need to reach origin), heavy computation
DNS Management
Standard DNS Setup
yourapp.com → A/ALIAS → Load balancer or CDN
www.yourapp.com → CNAME → yourapp.com
api.yourapp.com → A/ALIAS → API load balancer
staging.yourapp.com → A/ALIAS → Staging load balancer
*.yourapp.com → CNAME → Wildcard for tenant subdomains (if needed)
DNS Provider Recommendation
Use Cloudflare for DNS (free tier) regardless of hosting provider. Benefits: fast propagation, DDoS protection, proxied records hide origin IP, easy SSL.
SSL/TLS
- Use TLS 1.2+ (disable TLS 1.0 and 1.1)
- Automate certificate provisioning (Let's Encrypt via cert-manager, or Cloudflare automatic SSL)
- Enable HSTS headers:
Strict-Transport-Security: max-age=31536000; includeSubDomains - Redirect all HTTP to HTTPS at the load balancer or CDN level
Region Selection
Single Region (Start Here)
Pick the region closest to your primary user base:
| User Base | AWS Region | GCP Region |
|---|---|---|
| US East Coast | us-east-1 (N. Virginia) | us-east1 |
| US West Coast | us-west-2 (Oregon) | us-west1 |
| Europe | eu-west-1 (Ireland) or eu-central-1 (Frankfurt) | europe-west1 |
| Asia Pacific | ap-southeast-1 (Singapore) | asia-southeast1 |
Multi-Region (When You Need It)
Go multi-region only when you need:
- Sub-100ms latency globally
- Data residency compliance (EU data stays in EU)
- 99.99%+ uptime (survive region outages)
Multi-region adds significant complexity. Most SaaS products do not need it until 100K+ users or enterprise compliance requirements.
Cost Optimization
Cost Reduction Strategies
- Right-size instances: Start small, monitor actual usage, resize. Most services are over-provisioned.
- Reserved instances / savings plans: Commit to 1-year usage for 30-40% savings on stable workloads.
- Spot instances for non-critical work: Background jobs, CI runners, data processing at 60-90% discount.
- Auto-scale aggressively: Scale to zero for dev/staging environments outside business hours.
- Review storage costs: Delete old logs, compress cold data, use lifecycle policies to move to cheaper tiers.
- Egress optimization: Use CDN to reduce origin bandwidth, keep inter-service traffic in the same region/VPC.
Cost Monitoring
- Set up billing alerts at 50%, 80%, and 100% of budget
- Tag all resources by environment (prod, staging, dev) and service
- Review costs weekly during growth phase
- Use AWS Cost Explorer, GCP Cost Management, or third-party tools (Vantage, Infracost)
Cost Benchmarks by Stage
| Stage | Monthly Infra Cost | What You Get |
|---|---|---|
| Pre-launch | $0-25 | Free tiers, single small instance |
| Early (0-1K users) | $25-200 | Small app server, managed DB, basic CDN |
| Growth (1K-10K users) | $200-2,000 | Multiple services, Redis, queues, monitoring |
| Scale (10K-100K users) | $2,000-15,000 | Auto-scaling, multi-AZ, dedicated DB, full observability |
| Enterprise (100K+) | $15,000+ | Multi-region, reserved capacity, dedicated support |
Disaster Recovery
Backup Strategy
- Database: Automated daily backups with point-in-time recovery (PITR). Test restores monthly.
- File storage: Cross-region replication for S3/R2 buckets containing user uploads.
- Configuration: All infrastructure as code in version control. No manual configuration.
- Secrets: Backed up in a separate secrets manager (not just env vars on one platform).
Recovery Objectives
| Metric | Definition | Target for Most SaaS |
|---|---|---|
| RTO (Recovery Time Objective) | How long until service is restored | 1-4 hours |
| RPO (Recovery Point Objective) | How much data loss is acceptable | 1 hour (with PITR: minutes) |
Incident Response
- Detect: Monitoring alerts fire (see monitoring skill)
- Assess: Determine scope and severity
- Communicate: Update status page, notify affected customers
- Mitigate: Rollback deployment, failover to standby, or scale up
- Resolve: Fix root cause, verify fix in staging, deploy
- Review: Post-incident review within 48 hours, document learnings
Output Format
When providing cloud hosting guidance, deliver:
- Provider recommendation: Which provider and why, matched to stage and requirements
- Architecture diagram: Deployment topology (load balancer, app servers, database, cache, CDN)
- Deployment strategy: How code gets from git to production (blue-green, rolling, canary)
- Environment plan: How dev, staging, and production are structured
- Scaling approach: Auto-scaling policies, connection pooling, stateless design
- Cost estimate: Expected monthly cost with room to grow
- Migration path: If switching providers, step-by-step migration plan
Anti-Patterns to Avoid
- Over-engineering early: Do not set up Kubernetes for an MVP. Use Railway or Render until you outgrow them.
- Single point of failure: Always run at least 2 instances in production. Use managed databases with standby replicas.
- No staging environment: Never deploy directly to production without a staging step.
- Ignoring egress costs: Data transfer out of AWS/GCP can be expensive. Use CDN and keep traffic internal.
- Manual deployments: Every deployment should be automated and reproducible. No SSH-and-pray.
- No health checks: Load balancers need health endpoints to route traffic correctly.
- Hardcoded regions: Use environment variables for region-specific configuration.
- Skipping backups: Managed database backups are not optional. Enable PITR on day one.
Related Skills
- devops: Containerization, infrastructure as code, orchestration
- ci-cd: Automated build, test, and deployment pipelines
- monitoring: Uptime monitoring, alerting, observability for your infrastructure
- security: Network security, SSL/TLS, DDoS protection, access control