EC2 Tier Recommendations
Server sizing guide for the GSign platform.
Memory Requirements
Full Infrastructure
| Component | Memory |
|---|---|
| GitLab CE | 4 GB |
| PostgreSQL | 512 MB |
| MongoDB | 512 MB |
| Redis | 256 MB |
| Prometheus | 512 MB |
| Grafana | 256 MB |
| Loki | 512 MB |
| Go Backend | 256 MB |
| Next.js Frontend | 256 MB |
| HSM Backend | 128 MB |
| Documentation | 64 MB |
| System (Ubuntu + NGINX) | 512 MB |
| Total | ~9.9 GB |
Recommended Tiers
t3.large (Recommended)
| Spec | Value |
|---|---|
| vCPU | 2 |
| RAM | 8 GB |
| Network | Moderate |
| Cost | ~$60/month |
Best for:
- Full infrastructure deployment
- Comfortable headroom
- Development + staging
t3.medium (Budget)
| Spec | Value |
|---|---|
| vCPU | 2 |
| RAM | 4 GB |
| Network | Moderate |
| Cost | ~$30/month |
Requires:
- Disable GitLab Runner (saves 1 GB)
- Use Loki instead of Elasticsearch
- Remove database replicas
- Reduce Prometheus retention
t3.xlarge (Performance)
| Spec | Value |
|---|---|
| vCPU | 4 |
| RAM | 16 GB |
| Network | High |
| Cost | ~$120/month |
Best for:
- Team development
- High traffic staging
- Additional services
AWS Lightsail Alternative
Lightsail 8 GB (Best Value)
| Spec | Value |
|---|---|
| vCPU | 2 |
| RAM | 8 GB |
| SSD | 160 GB |
| Transfer | 4 TB |
| Cost | $40/month |
Benefits:
- Fixed pricing (no surprises)
- Same performance as t3.large
- Simpler management
- 4 TB transfer included
Cost Optimization
Spot Instances
Save up to 70% with spot instances:
| Instance | On-Demand | Spot |
|---|---|---|
| t3.large | $60/month | ~$18/month |
| t3.xlarge | $120/month | ~$36/month |
Risk: Instance can be interrupted (2-minute warning)
Use case: Development environments, batch processing
Reserved Instances
Save 40-60% with 1-3 year commitment:
| Term | Discount |
|---|---|
| 1 year, no upfront | 40% |
| 1 year, all upfront | 45% |
| 3 year, all upfront | 60% |
Stop When Not in Use
Development server running 8 hours/day:
- Regular: $60/month
- 8 hours/day: ~$20/month
Weekend shutdown:
- Regular: $60/month
- Weekdays only: ~$45/month
Lightweight Setup (4 GB)
For t3.medium with 4 GB RAM:
Disable GitLab Runner
yaml
# Remove from docker-compose
# gitlab-runner: ...Saves: 1 GB
Use Loki Instead of EFK
Already using Loki (lighter than Elasticsearch)
Saves: 3 GB (vs EFK stack)
Single Database Instances
No replicas:
- PostgreSQL: 1 instance
- MongoDB: 1 instance
- Redis: 1 instance
Saves: 800 MB
Reduce Prometheus Retention
yaml
# prometheus.yml
--storage.tsdb.retention.time=7d # from 30dSaves: 200 MB
Result: 9.9 GB → ~5.2 GB (fits in 4 GB with swap)
Quick Decision Matrix
| Requirement | Recommendation |
|---|---|
| Full infrastructure, comfort | t3.large ($60) |
| Budget development | t3.medium ($30) + optimizations |
| Team development | t3.xlarge ($120) |
| Best value | Lightsail 8 GB ($40) |
| Production preview | t3.large or Lightsail |
| CI/CD with builds | t3.large minimum |
Setup Commands
EC2 t3.large
bash
# Launch instance
aws ec2 run-instances \
--instance-type t3.large \
--image-id ami-0xxx \
--key-name gsign-key \
--security-group-ids sg-xxx \
--block-device-mappings "[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"VolumeSize\":100}}]"Lightsail
bash
# Create instance
aws lightsail create-instances \
--instance-names gsign-dev \
--availability-zone eu-north-1a \
--blueprint-id ubuntu_24_04 \
--bundle-id large_3_0Monitoring Resources
bash
# Memory usage
free -h
# Disk usage
df -h
# Container resources
docker stats
# Top processes
htopDisk Recommendations
| Environment | Size | Type |
|---|---|---|
| Development | 50 GB | gp3 |
| Staging | 100 GB | gp3 |
| Production | 200+ GB | gp3 |
Note: GitLab + databases can grow quickly. Monitor disk usage.