A hands-on project demonstrating how to deploy, monitor, and manage a full-stack Dockerized application on AWS EC2 using Infrastructure as Code (Terraform), bash automation scripts, and best practices in backup and monitoring.
fresh_key.pem
& fresh_key.pub
)git clone https://github.com/arduino731/DevOps-Linux-System-Admin.git
cd DevOps-Linux-System-Admin
cd ec2-terraform-demo
terraform init
terraform apply
Make sure your ~/.ssh/fresh_key.pub
exists locally.
aws configure
./deploy.sh
This will:
/etc/cron.daily
[Local Dev Machine] --rsync+SSH--> [EC2 Instance]
|
|-- Docker Compose
| ├── Frontend (Nginx on :8080)
| └── Backend (Node.js on :5001)
|
|-- Cron Script -> /var/log/monitor.log
|-- CloudWatch Agent
|-- Fail2ban (SSH protection)
Use backup.sh
to archive data volumes or app code:
./backup.sh
Store archives locally or upload to S3 for durability.
rsync -avz backup.tar.gz ubuntu@<EC2-IP>:/home/ubuntu/
ssh -i ~/.ssh/fresh_key.pem ubuntu@<EC2-IP>
cd /home/ubuntu && tar -xzvf backup.tar.gz
cd DevOps-Linux-System-Admin && docker-compose up -d --build
terraform destroy
Then re-run from Setup Instructions:
terraform apply
./deploy.sh
fresh_key.pem
still matches EC2 authorized key.monitor.sh
: Local disk + uptime cron script logged daily to /var/log/monitor.log
DevOps-Linux-System-Admin/
├── backend/ # Node.js app
├── frontend/ # Static HTML site via Nginx
├── monitoring/monitor.sh # Cron script
├── deploy.sh # Rsync & container setup
├── setup.sh # System prep & Docker install
├── backup.sh # Backup logic
├── docker-compose.yml
└── ec2-terraform-demo/ # Terraform configs
Maintained by Brian — feel free to fork, star, or reach out with feedback or questions.