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:
| Feature | Description |
|---|---|
| Source | GitHub, GitLab, Container Registry |
| Scaling | Automatic horizontal scaling |
| SSL | Free managed certificates |
| Domains | Custom domain support |
| Databases | Attached 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:
| Type | Use Case |
|---|---|
| Basic | Dev/test, small apps |
| General Purpose | Balanced workloads |
| CPU-Optimized | Compute-intensive |
| Memory-Optimized | Databases, caching |
| Storage-Optimized | Large 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
| Requirement | Solution |
|---|---|
| Simple web app | App Platform |
| Quick deployment | App Platform |
| Docker containers | App Platform or Kubernetes |
| Custom software | Droplets |
| Multiple microservices | Kubernetes |
| Scheduled jobs | Functions or App Platform Workers |
| GPU workloads | GPU 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:
| Engine | Min Price | Features |
|---|---|---|
| PostgreSQL | $15/mo | Read replicas, connection pooling |
| MySQL | $15/mo | Read replicas |
| Redis | $15/mo | High availability |
| MongoDB | $15/mo | Sharding support |
| Kafka | $99/mo | Event 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:
| Aspect | How It Works |
|---|---|
| Billing | Monthly, prorated |
| Bandwidth | 1TB free per Droplet |
| Overage | $0.01/GB over limit |
| Reserved IPs | Free 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
| Resource | DigitalOcean | AWS 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
| Region | Code | Location |
|---|---|---|
| New York 1 | nyc1 | New York, USA |
| New York 3 | nyc3 | New York, USA |
| San Francisco 2 | sfo2 | San Francisco, USA |
| San Francisco 3 | sfo3 | San Francisco, USA |
| Amsterdam 3 | ams3 | Amsterdam, Netherlands |
| Singapore 1 | sgp1 | Singapore |
| London 1 | lon1 | London, UK |
| Frankfurt 1 | fra1 | Frankfurt, Germany |
| Toronto 1 | tor1 | Toronto, Canada |
| Bangalore 1 | blr1 | Bangalore, India |
| Sydney 1 | syd1 | Sydney, 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
- Use Projects to group related resources
- Apply consistent tags
- Document your architecture
- Set up monitoring from day one
Security
- Use SSH keys, not passwords
- Configure firewalls
- Use VPCs for internal traffic
- Enable two-factor authentication
- Rotate API tokens regularly
Cost Management
- Right-size resources (start small)
- Delete unused resources
- Use reserved Droplets for long-running workloads
- 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.