Automated deployment pipeline with AWS, Terraform, Docker, Prometheus, and Grafana.
This project implements a complete DevOps pipeline with hybrid CI/CD approach, combining cloud-native tools with traditional configuration management for production-grade deployment automation.
- Infrastructure as Code with Terraform
- Containerized application deployment
- Hybrid CI/CD (GitHub Actions + Ansible)
- Comprehensive monitoring with Prometheus and Grafana
- Cost optimization (~$2/month)
- Automated backup and recovery
Developer → Git Push → GitHub Actions (CI)
↓
Build & Test & Push
↓
Docker Hub
Local Machine → Ansible (CD) → EC2
↓
Docker + Prometheus + Grafana
↓
S3 Backup + CloudWatch Logs
Infrastructure
- Terraform (AWS EC2, VPC, Security Groups, S3, CloudWatch)
- Ansible (Configuration management and deployment automation)
Application
- Node.js Express with Prometheus metrics
- Docker containerization
- Docker Hub registry
CI/CD
- GitHub Actions (Continuous Integration)
- Ansible (Continuous Deployment)
Monitoring
- Prometheus (Metrics collection)
- Grafana (Visualization with 3 dashboards)
- Node Exporter (System metrics)
- AWS CloudWatch (Logs)
Cloud
- AWS EC2 (t3.micro)
- AWS S3 (Backup storage)
- AWS CloudWatch (Log aggregation)
- AWS Budgets (Cost tracking)
This project uses a hybrid CI/CD approach combining the best of both worlds:
GitHub Actions (CI)
- Automated build on every push
- Docker image creation
- Image push to Docker Hub
- Automated testing
Ansible (CD)
- Automated deployment to EC2
- Configuration management
- Idempotent operations
- Versioned playbooks
This separation provides:
- Better security (no SSH keys in GitHub)
- Flexibility in deployment targets
- Version-controlled deployment scripts
- Industry-standard practices
Terraform >= 1.0
Ansible >= 2.9
Docker >= 20.10
AWS CLI >= 2.0
Node.js >= 18
AWS Free Tier account
git clone https://github.com/berke44gulec/cloud-native-devops-pipeline.git
cd cloud-native-devops-pipelineaws configuressh-keygen -t rsa -b 4096 -f ~/.ssh/devops-pipeline
chmod 600 ~/.ssh/devops-pipelinecd terraform
cp terraform.tfvars.example terraform.tfvars
nano terraform.tfvars # Update values
terraform init
terraform plan
terraform applydocker build -t YOUR_USERNAME/cloud-native-devops:latest .
docker login
docker push YOUR_USERNAME/cloud-native-devops:latestnano ansible/inventory/hosts
# Update EC2 IP address and Docker image nameansible-playbook -i ansible/inventory/hosts ansible/playbooks/deploy.ymlConfigure these secrets in GitHub repository settings:
DOCKER_USERNAME: Docker Hub usernameDOCKER_PASSWORD: Docker Hub password or access token
The CI pipeline automatically:
- Runs tests on every push
- Builds Docker image on main branch
- Pushes to Docker Hub with version tags
- Provides deployment instructions
git add .
git commit -m "feat: New feature"
git push origin main
# GitHub Actions automatically builds and pushes Docker image# Deploy to EC2
ansible-playbook -i ansible/inventory/hosts ansible/playbooks/deploy.yml
# Setup monitoring
ansible-playbook -i ansible/inventory/hosts ansible/playbooks/setup-monitoring.yml
# Run backup
ansible-playbook -i ansible/inventory/hosts ansible/playbooks/backup.ymlAfter deployment:
Application: http://EC2_IP:3000
Prometheus: http://EC2_IP:9090
Grafana: http://EC2_IP:3001 (admin/password)
- CPU Usage
- Memory Usage
- Disk Usage
- Network Traffic
- System Load Average
- Disk I/O
- HTTP Request Rate
- Average Response Time
- Response Time p95
- Total Requests
- Requests by Status Code
- Process Memory Usage
- System Health Gauges
- Application Statistics
- Trend Graphs
EC2 (t3.micro): $0.00 (Free Tier)
EBS (20GB): $0.00 (Free Tier)
S3 (5GB): $0.00 (Free Tier)
Data Transfer: ~$0.50
CloudWatch: $0.00 (Free Tier)
-------------------------------------------
Total: ~$0.50-2.00/month
- Security Groups with IP whitelisting for SSH
- Encrypted EBS volumes
- S3 versioning enabled
- Non-root container user
- IAM least privilege policies
- SSH keys stored locally (not in GitHub)
cloud-native-devops-pipeline/
├── terraform/
│ ├── main.tf
│ ├── variables.tf
│ ├── outputs.tf
│ └── scripts/
├── ansible/
│ ├── inventory/
│ ├── playbooks/
│ │ ├── deploy.yml
│ │ ├── setup-monitoring.yml
│ │ └── backup.yml
│ └── roles/
│ ├── docker/
│ ├── prometheus/
│ └── app-deploy/
├── app/
│ ├── src/
│ │ └── server.js
│ └── package.json
├── monitoring/
│ ├── prometheus/
│ └── grafana/
├── .github/workflows/
│ └── deploy.yml
├── Dockerfile
└── README.md
# Health check
curl http://EC2_IP:3000/health
# Metrics endpoint
curl http://EC2_IP:3000/metrics
# Load test
for i in {1..100}; do curl http://EC2_IP:3000; doneCheck Security Group:
aws ec2 describe-security-groups --group-names devops-pipeline-sgCheck your current IP:
curl https://api.ipify.orgUpdate IP in terraform.tfvars and reapply.
Check logs:
docker logs appRestart container:
docker restart appCheck service status:
sudo systemctl status prometheusRestart service:
sudo systemctl restart prometheus# Deploy application
ansible-playbook -i ansible/inventory/hosts ansible/playbooks/deploy.yml
# Setup monitoring stack
ansible-playbook -i ansible/inventory/hosts ansible/playbooks/setup-monitoring.yml
# Run backup
ansible-playbook -i ansible/inventory/hosts ansible/playbooks/backup.yml
# Dry run
ansible-playbook -i ansible/inventory/hosts ansible/playbooks/deploy.yml --check
# Verbose output
ansible-playbook -i ansible/inventory/hosts ansible/playbooks/deploy.yml -v- Kubernetes migration (EKS)
- Auto-scaling implementation
- Blue-Green deployment
- Advanced alerting (PagerDuty/Slack)
- Security scanning (Trivy)
- Load testing (K6)
- Multi-region deployment
- Vault integration for secrets
- Infrastructure as Code with Terraform
- Container orchestration with Docker
- Cloud platform management (AWS)
- Monitoring and observability (Prometheus, Grafana)
- Configuration management with Ansible
- CI/CD pipeline design (hybrid approach)
- Cost optimization strategies
- Infrastructure versioning
- Immutable infrastructure
- Automated deployment workflows
- Security best practices
- Separation of concerns in CI/CD
This project is for educational purposes.
This project is licensed under the MIT License.