Deploying Production DICOM PACS on AWS: S3 + Orthanc in 3 Weeks
How we deployed a production-ready DICOM PACS system on AWS for a healthcare startup in 3 weeks. Orthanc + S3 + PostgreSQL architecture with VPN security.
A healthcare startup approached us with a straightforward need: deploy a secure DICOM storage system for DXA (bone density) scans. They needed it fast, secure, and cost-effective.
Timeline: 3 weeks Budget: Mid-size project Result: Production DICOM PACS handling 1500+ studies with VPN-only access
This is how we built it.
The Requirements
The client had clear needs:
- Secure storage for medical imaging (DXA scans)
- Cloud-native deployment on AWS
- HTTPS API for programmatic access
- VPN-only access - no public exposure
- Cost-effective - optimize for small-to-medium scale
- Fast deployment - 3 weeks to production
They also needed basic monitoring and automated backups. Nothing fancy, but production-grade.
Why Orthanc Over Commercial PACS?
We evaluated several options:
Commercial PACS solutions (Sectra, Agfa, GE):
- ❌ $50,000+ upfront licensing
- ❌ Vendor lock-in
- ❌ Complex deployment
- ❌ Overkill for their scale
Cloud-managed options (AWS HealthLake):
- ❌ $0.005 per object/month (expensive at scale)
- ❌ Complex migration if they outgrow it
- ✅ Compliance built-in (HIPAA)
Orthanc (open-source DICOM server):
- ✅ Free and open-source
- ✅ Docker-ready deployment
- ✅ S3 plugin for cloud storage
- ✅ REST API for integration
- ✅ Proven in production (hospitals worldwide)
We chose Orthanc. For a startup with 1500 studies, it's the sweet spot of cost, flexibility, and performance.
Architecture: Defense in Depth
Medical data requires multiple security layers. We built defense-in-depth:
DXA Machines / Frontend
↓
VPN Tunnel (Client-Managed)
↓
Security Group (VPN IPs Only)
↓
HTTPS (Self-Signed Cert)
↓
Orthanc DICOM Server (Docker)
↙ ↓ ↘
PostgreSQL S3 DICOM Receiver
Security Layers
Layer 1: Security Group
- Blocks all external traffic
- Allows only whitelisted VPN IP ranges
- No public internet access
Layer 2: VPN Tunnel
- Client-managed VPN (Tailscale recommended)
- Encrypted tunnel to server
- Zero-trust network access
Layer 3: HTTPS
- Self-signed certificate (Orthanc native SSL/TLS)
- All API calls encrypted in transit
- Certificate pinning possible for extra security
Layer 4: Orthanc Authentication
- HTTP basic auth for REST API
- DICOM AE Title validation for C-STORE
- Per-user access control
Layer 5: S3 Encryption
- Server-side encryption (AES-256)
- Data encrypted at rest
- Versioning enabled for recovery
Technical Stack
Infrastructure:
- AWS EC2 (t3.medium: 2vCPU, 4GB RAM, 40GB disk)
- AWS S3 for DICOM pixel data storage
- CloudWatch for monitoring and alerts
- SNS for email notifications
Application:
- Orthanc 1.11+ (DICOM server in Docker)
- PostgreSQL 15 (metadata indexing)
- Docker Compose for orchestration
Key Design Decisions:
1. S3 vs EBS for DICOM Storage
We chose S3 over EBS:
- ✅ Cheaper at scale ($0.023/GB vs $0.08/GB)
- ✅ Infinite scalability
- ✅ Built-in redundancy
- ✅ Lifecycle policies for archival
- ❌ Slightly higher latency (acceptable for PACS)
2. Self-Managed PostgreSQL vs RDS
We chose self-managed PostgreSQL on EC2:
- ✅ Lower cost (~$0 vs ~$30-60/month)
- ✅ Full control over configuration
- ✅ Simple backup to S3
- ❌ No automatic failover (acceptable for startup scale)
When they scale beyond 5,000+ studies, we can migrate to RDS for HA.
3. Docker vs Kubernetes
We chose Docker Compose:
- ✅ Simple deployment
- ✅ Easy to reproduce
- ✅ Single-instance deployment (their scale doesn't need K8s)
- ✅ Lower overhead
Kubernetes would be overkill for this use case.
Implementation: Week by Week
Week 1: Core Infrastructure
Goal: Orthanc running on HTTPS with S3 storage
What we deployed:
- EC2 instance with Docker installed
- Security Group configured (VPN IPs whitelisted)
- Orthanc container with S3 plugin
- PostgreSQL for metadata
- Self-signed HTTPS certificate
Testing:
- Client uploaded test DICOM files via C-STORE
- Retrieved files via REST API through VPN
- Verified S3 storage working
- End-to-end validation complete
Milestone 1: ✅ Production-ready core delivered
Week 2-3: Monitoring & Automation
Goal: Observability and automated backups
What we added:
- CloudWatch monitoring:
- Disk usage >80% → email alert
- CPU usage >70% for 5+ min → email alert
- PostgreSQL connection failures → email alert
- Automated daily backups:
- PostgreSQL dump to S3 via cron
- 30-day retention policy
- Logs visible in CloudWatch
- Complete documentation:
- API examples with curl
- Architecture diagram
- Backup/restore runbook
- Troubleshooting guide
Milestone 2: ✅ Monitoring and automation delivered
Docker Configuration
Here's the core of our deployment (simplified):
version: '3.8'
services:
orthanc:
image: jodogne/orthanc-plugins:latest
container_name: orthanc
restart: always
ports:
- "8042:8042" # HTTPS REST API
- "4242:4242" # DICOM receiver
volumes:
- ./orthanc.json:/etc/orthanc/orthanc.json:ro
- ./certs:/certs:ro
environment:
- ORTHANC_NAME=ProductionPACS
- ORTHANC_AET=ORTHANC
depends_on:
- postgres
postgres:
image: postgres:15
container_name: postgres
restart: always
environment:
- POSTGRES_DB=orthanc
- POSTGRES_USER=orthanc
- POSTGRES_PASSWORD=${DB_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:
Orthanc S3 Plugin Configuration:
{
"Plugins": ["/usr/share/orthanc/plugins"],
"AwsS3Storage": {
"BucketName": "dicom-storage-production",
"Region": "us-east-1",
"Encryption": "AES256",
"StorageStructure": "flat"
},
"PostgreSQL": {
"Host": "postgres",
"Port": 5432,
"Database": "orthanc"
},
"SslEnabled": true,
"SslCertificate": "/certs/server.crt"
}
Monitoring Setup
CloudWatch Alarms:
# Disk usage alarm
aws cloudwatch put-metric-alarm \
--alarm-name orthanc-disk-usage \
--alarm-description "Alert when disk usage >80%" \
--metric-name DiskSpaceUtilization \
--namespace System/Linux \
--statistic Average \
--period 300 \
--threshold 80 \
--comparison-operator GreaterThanThreshold \
--evaluation-periods 2 \
--alarm-actions arn:aws:sns:us-east-1:123456:alerts
Automated PostgreSQL Backup:
#!/bin/bash
# /opt/scripts/backup-postgres.sh
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
BACKUP_FILE="orthanc_backup_${TIMESTAMP}.sql"
# Dump database
docker exec postgres pg_dump -U orthanc orthanc > /tmp/${BACKUP_FILE}
# Compress and upload to S3
gzip /tmp/${BACKUP_FILE}
aws s3 cp /tmp/${BACKUP_FILE}.gz s3://dicom-backups/postgres/ \
--storage-class STANDARD_IA
# Clean up local file
rm /tmp/${BACKUP_FILE}.gz
# Apply 30-day retention
aws s3 ls s3://dicom-backups/postgres/ \
| awk '{print $4}' \
| while read file; do
FILE_DATE=$(echo $file | grep -oP '\d{8}')
AGE=$(( ($(date +%s) - $(date -d "$FILE_DATE" +%s)) / 86400 ))
if [ $AGE -gt 30 ]; then
aws s3 rm s3://dicom-backups/postgres/$file
fi
done
Cron: 0 2 * * * /opt/scripts/backup-postgres.sh
Performance Results
After deployment, the system handles:
- Study listing: Under 2 seconds for 1500+ studies
- DICOM upload: 100MB+ files via REST API
- Concurrent requests: 10-20 simultaneous API calls
- Storage costs: ~$35/month (S3 + backups)
- Uptime: 99.9%+ (monitored via CloudWatch)
Monthly Operating Costs:
| Component | Cost |
|---|---|
| EC2 t3.medium | ~$35-45/month |
| S3 storage (1TB) | ~$23/month |
| S3 backups | ~$4/month |
| CloudWatch + SNS | ~$5-10/month |
| Total | ~$70-80/month |
Compare this to commercial PACS at $50,000+ upfront + $5,000/year maintenance.
Lessons Learned
1. Open-Source PACS is Production-Ready
Orthanc powers hospitals worldwide. For startups and small clinics, it's a no-brainer. You get:
- Full DICOM protocol support
- REST API for integration
- Active community and plugins
- Zero licensing costs
2. S3 is Perfect for Medical Imaging
DICOM files are write-once, read-occasionally. S3's cost structure fits perfectly:
- Cheap storage ($0.023/GB)
- Infrequent access tier for archival
- Lifecycle policies automate cost optimization
- Built-in redundancy
3. Defense-in-Depth is Non-Negotiable
Medical data requires multiple security layers:
- Network isolation (Security Groups)
- VPN tunnel (Tailscale, OpenVPN)
- Encryption in transit (HTTPS)
- Encryption at rest (S3)
- Application auth (Orthanc)
Any one layer can fail. Defense-in-depth ensures security.
4. Self-Managed PostgreSQL Works at Small Scale
For under 10,000 studies, self-managed PostgreSQL on EC2 is cost-effective:
- $0 vs $30-60/month for RDS
- Daily backups to S3 sufficient
- Simple restore procedures
When scaling beyond this, migrate to RDS for HA.
5. Docker Simplifies PACS Deployment
Traditional PACS deployment is a nightmare (dependencies, libraries, configs). Docker makes it:
- Reproducible (same config every time)
- Portable (works on any EC2 instance)
- Simple to rollback (docker-compose down/up)
Future Scaling Options
When the client outgrows single-instance deployment, they have options:
Option A: Horizontal Scaling
- Add second EC2 + Orthanc instance
- Deploy HAProxy or AWS ALB
- Share PostgreSQL + S3
- Cost: +$40-50/month per instance
- Timeline: 1-2 weeks
Option B: Migrate to AWS HealthLake
- Fully managed DICOM service
- Technical safeguards designed around HIPAA requirements
- Auto-scaling
- Cost: ~$0.005/object/month
- Timeline: 3-4 weeks (migration complexity)
Option C: High Availability Clustering
- 3+ Orthanc instances
- PostgreSQL HA (Patroni or RDS Multi-AZ)
- Redis caching
- Cost: +$150-250/month
- Timeline: 3-4 weeks
Takeaways for Your PACS Project
If you're building healthcare imaging infrastructure:
- Start with Orthanc - proven, open-source, cost-effective
- Use S3 for storage - cheaper than EBS at scale
- Defense-in-depth security - VPN + HTTPS + encryption
- Monitor from day one - CloudWatch alarms prevent outages
- Automate backups - PostgreSQL dumps to S3 daily
- Docker for deployment - reproducible and portable
- Plan for scaling - start simple, add HA when needed
Read the full case study for implementation details and metrics.
Questions about DICOM PACS deployment? Reach out at contact@aklabs.dev