DigitalOcean
beginner
20-25 minutes

DigitalOcean Core Concepts

Understand DigitalOcean's services, pricing model, and how resources work together.

What you'll accomplish

Clear understanding of DigitalOcean services and when to use each

Prerequisites

  • DigitalOcean account created
  • doctl CLI installed

DigitalOcean Service Overview

DigitalOcean offers focused services for developers:

┌─────────────────────────────────────────────────────────────────┐
│                      DigitalOcean Platform                      │
├─────────────────────────────────────────────────────────────────┤
│  Compute           │  Storage          │  Databases             │
│  ├── App Platform  │  ├── Spaces       │  ├── PostgreSQL        │
│  ├── Droplets      │  ├── Volumes      │  ├── MySQL             │
│  ├── Kubernetes    │  └── Backups      │  ├── Redis             │
│  └── Functions     │                   │  └── MongoDB           │
├─────────────────────────────────────────────────────────────────┤
│  Networking        │  Developer Tools  │  Management            │
│  ├── VPCs          │  ├── Container    │  ├── Projects          │
│  ├── Load Balancers│  │   Registry     │  ├── Monitoring        │
│  ├── Firewalls     │  ├── API          │  ├── Teams             │
│  └── Domains       │  └── Marketplace  │  └── Billing           │
└─────────────────────────────────────────────────────────────────┘

Compute Services

App Platform (Recommended for Most Apps)

Managed PaaS that deploys from Git:

FeatureDescription
SourceGitHub, GitLab, Container Registry
ScalingAutomatic horizontal scaling
SSLFree managed certificates
DomainsCustom domain support
DatabasesAttached managed databases
yaml
# Example app spec
name: myapp
services:
  - name: web
    github:
      repo: user/myapp
      branch: main
    run_command: npm start
    http_port: 3000

Best for: Web apps, APIs, microservices, static sites

Droplets (Virtual Machines)

Full control virtual servers:

TypeUse Case
BasicDev/test, small apps
General PurposeBalanced workloads
CPU-OptimizedCompute-intensive
Memory-OptimizedDatabases, caching
Storage-OptimizedLarge datasets
bash
# Create a Droplet
doctl compute droplet create myserver \
  --image ubuntu-22-04-x64 \
  --size s-1vcpu-1gb \
  --region nyc1

Best for: Custom software, legacy apps, full control needed

Kubernetes (DOKS)

Managed Kubernetes clusters:

bash
# Create cluster
doctl kubernetes cluster create mycluster \
  --region nyc1 \
  --node-pool "name=default;size=s-2vcpu-2gb;count=3"

Best for: Container orchestration, microservices at scale

Functions (Serverless)

Event-driven serverless functions:

bash
# Deploy function
doctl serverless deploy

Best for: Event processing, scheduled tasks, APIs

Choosing the Right Compute

Start here: What are you deploying?
    │
    ├── Web app from Git? → App Platform
    │
    ├── Containers with orchestration? → Kubernetes
    │
    ├── Event-driven/scheduled code? → Functions
    │
    └── Need full OS control? → Droplets
RequirementSolution
Simple web appApp Platform
Quick deploymentApp Platform
Docker containersApp Platform or Kubernetes
Custom softwareDroplets
Multiple microservicesKubernetes
Scheduled jobsFunctions or App Platform Workers
GPU workloadsGPU Droplets

Storage Services

Spaces (Object Storage)

S3-compatible object storage:

bash
# List Spaces
doctl compute spaces list

# Create Space
doctl compute spaces create myspace --region nyc3

Features:

  • CDN included ($5/month for 250GB)
  • S3-compatible API
  • Static website hosting
  • Access control

Best for: User uploads, backups, static assets, media files

Volumes (Block Storage)

Attachable SSD storage for Droplets:

bash
# Create volume
doctl compute volume create myvolume \
  --region nyc1 \
  --size 100GiB

# Attach to Droplet
doctl compute volume-action attach VOLUME_ID DROPLET_ID

Features:

  • Resize without downtime
  • Snapshot support
  • Up to 16TB per volume

Best for: Database storage, application data, file systems

Backups

Automatic Droplet backups:

bash
# Enable backups
doctl compute droplet create myserver \
  --image ubuntu-22-04-x64 \
  --enable-backups

Features:

  • Weekly automatic backups
  • 4-week retention
  • 20% of Droplet cost

Database Services

Managed Databases

Fully managed database clusters:

EngineMin PriceFeatures
PostgreSQL$15/moRead replicas, connection pooling
MySQL$15/moRead replicas
Redis$15/moHigh availability
MongoDB$15/moSharding support
Kafka$99/moEvent streaming
bash
# Create PostgreSQL database
doctl databases create mydb \
  --engine pg \
  --size db-s-1vcpu-1gb \
  --region nyc1

# Get connection string
doctl databases connection DB_ID

Database Features

  • Automatic backups - Daily backups with PITR
  • High availability - Standby nodes
  • Read replicas - Scale reads
  • Connection pooling - PostgreSQL PgBouncer
  • Private networking - VPC access
  • Maintenance windows - Scheduled updates

Networking

VPCs (Virtual Private Cloud)

Isolated private networks:

bash
# Create VPC
doctl vpcs create myvpc \
  --name myvpc \
  --region nyc1 \
  --ip-range 10.10.10.0/24
  • Resources communicate privately
  • No egress charges within VPC
  • Cross-resource networking

Firewalls

Network security rules:

bash
# Create firewall
doctl compute firewall create myfw \
  --name myfw \
  --inbound-rules "protocol:tcp,ports:22,address:0.0.0.0/0 protocol:tcp,ports:80,address:0.0.0.0/0"

Load Balancers

Distribute traffic across Droplets:

bash
# Create load balancer
doctl compute load-balancer create \
  --name mylb \
  --region nyc1 \
  --forwarding-rules entry_protocol:http,entry_port:80,target_protocol:http,target_port:3000 \
  --droplet-ids ID1,ID2

Features:

  • SSL termination
  • Health checks
  • Sticky sessions
  • $12/month

Domains and DNS

Manage DNS records:

bash
# Add domain
doctl compute domain create example.com

# Add record
doctl compute domain records create example.com \
  --record-type A \
  --record-name www \
  --record-data 1.2.3.4

Projects

Organize resources logically:

Project: Production
├── Droplet: prod-web-1
├── Droplet: prod-web-2
├── Database: prod-db
├── Load Balancer: prod-lb
└── Space: prod-uploads

Project: Development
├── Droplet: dev-server
└── Database: dev-db

Move resources between projects in the UI or via API.

Monitoring

Built-in Metrics

All resources report:

  • CPU usage
  • Memory usage
  • Disk I/O
  • Network bandwidth

Alerting

bash
# Via Control Panel:
# 1. Monitoring → Create Alert
# 2. Select resource
# 3. Set threshold
# 4. Add notification channel

Alert types:

  • CPU > threshold
  • Memory > threshold
  • Disk usage > threshold
  • Bandwidth > threshold

Uptime Checks

Monitor endpoints:

  • HTTP/HTTPS checks
  • TCP checks
  • Multi-region monitoring
  • Slack/email notifications

Pricing Model

Simple Pricing

DigitalOcean uses straightforward monthly pricing:

AspectHow It Works
BillingMonthly, prorated
Bandwidth1TB free per Droplet
Overage$0.01/GB over limit
Reserved IPsFree when attached
Snapshots$0.05/GB/month

No Hidden Costs

Unlike other clouds:

  • No egress charges within region
  • Predictable monthly bills
  • No complex pricing tiers
  • No per-request charges (App Platform)

Cost Comparison

ResourceDigitalOceanAWS Equivalent
1GB Droplet$6/mo~$8-10/mo (EC2)
Managed PostgreSQL$15/mo~$15-25/mo (RDS)
Object Storage$5/mo (250GB)~$5-10/mo (S3)
Load Balancer$12/mo~$16-25/mo (ALB)

Regions

Available Regions

RegionCodeLocation
New York 1nyc1New York, USA
New York 3nyc3New York, USA
San Francisco 2sfo2San Francisco, USA
San Francisco 3sfo3San Francisco, USA
Amsterdam 3ams3Amsterdam, Netherlands
Singapore 1sgp1Singapore
London 1lon1London, UK
Frankfurt 1fra1Frankfurt, Germany
Toronto 1tor1Toronto, Canada
Bangalore 1blr1Bangalore, India
Sydney 1syd1Sydney, Australia

Region Selection

Consider:

  • User location - Choose closest region
  • Compliance - Data residency requirements
  • Redundancy - Multi-region for HA
  • Features - Most features in NYC/SFO

Best Practices

Resource Naming

{project}-{environment}-{resource}-{number}

Examples:
- myapp-prod-web-1
- myapp-staging-db
- myapp-prod-lb

Organization

  1. Use Projects to group related resources
  2. Apply consistent tags
  3. Document your architecture
  4. Set up monitoring from day one

Security

  1. Use SSH keys, not passwords
  2. Configure firewalls
  3. Use VPCs for internal traffic
  4. Enable two-factor authentication
  5. Rotate API tokens regularly

Cost Management

  1. Right-size resources (start small)
  2. Delete unused resources
  3. Use reserved Droplets for long-running workloads
  4. Monitor usage and set alerts
Note

Checkpoint: Review your project organization in the control panel, understand which services fit your use case, and plan your architecture.