Project Name: Trust Me, Iβm a DevOps Engineer
-
GitHub Repository:
https://github.com/Lexxick/devops-bootcamp-project -
Web Application:
http://web.syedazam.my -
Monitoring (Grafana via Cloudflare Tunnel):
https://monitoring.syedazam.my -
Documentation (GitHub Pages):
https://lexxick.github.io/devops-bootcamp-project/
- .gitignore
- .github/workflows
pages.yml ecr-build-push.yml
- providers.tf
- iam.tf
- backend.tf
- ec2.tf
- ecr.tf
- vpc.tf
- security.tf
- variables.tf
- bootstrap.tf
- user_data_controller.sh Install all prerequisites and write SSH Key
- user_data_node.sh Install all prerequisites and write SSH Key
- outputs.tf
- playbooks
site.yml web.yml monitoring.yml
- group_vars
all.yml cloudflare_token.yml manually added into ec2 to avoid git hub
- templates
docker-compose.yml.j2 prometheus.yml.j2
git clone https://github.com/Infratify/lab-final-project mv lab-final-project dockercd dockeraws ecr get-login-password --region ap-southeast-1 | docker login --username AWS --password-stdin <ECR-id>.dkr.ecr.ap-southeast-1.amazonaws.com/<ECR-Container-Name> #Get in AWS Console view push commandsdocker build -t devops-bootcamp-project-syedazam .docker tag <ECR-Container-Name>:latest <ECR-id>.dkr.ecr.ap-southeast-1.amazonaws.com/<ECR-Container-Name> #Get in AWS Console view push commands- docker push <ECR-id>.dkr.ecr.ap-southeast-1.amazonaws.com/<ECR-Container-Name> #Get in AWS Console view push commandsAll infrastructure is provisioned using Terraform in ap-southeast-1.
- VPC:
10.0.0.0/24 - Public Subnet:
10.0.0.0/25 - Private Subnet:
10.0.0.128/25 - Internet Gateway + NAT Gateway
| Role | Private IP | Access |
|---|---|---|
| Web Server | 10.0.0.5 | Public (EIP) |
| Ansible Controller | 10.0.0.135 | Private (SSM only) |
| Monitoring Server | 10.0.0.136 | Private (Cloudflare Tunnel) |
- Terraform state stored in S3
user_data_controller.shinstalls Ansible and prepares inventoryuser_data_node.shinstalls Docker and Node Exporter- All servers are accessed via AWS SSM
All Ansible tasks are executed from the Ansible Controller.
- Docker installed
- Application container deployed
- Node Exporter running on port
9100
- Docker installed
- Prometheus + Grafana deployed using Docker Compose
- Prometheus scrapes Web Server metrics
- Grafana exposed securely via Cloudflare Tunnel
aws ssm start-session --target <ANSIBLE_CONTROLLER_INSTANCE_ID>sudo -iu ubuntugit clone https://github.com/Lexxick/devops-bootcamp-project.gitcd devops-bootcamp-project/ansiblecd group_varsnano cloudflare_token.yml cloudflared_tunnel_token: "TOKEN_FROM_LOCAL_CLOUDFLARE_TOKEN.YML"cd ../playbooksansible-playbook /site.yml- Type A : Web : (Web ec2 Elastic IP) if destory infra need to change new
- Type Cname : Monitoring : (from tunnel)
- Set to Flexible (per project task)
- monitoring-tunnel
- Import
- Prometheus Source =
- Create Iam User
- Attach Permission
AmazonEC2ContainerRegistryFullAccess AmazonSSMFullAccess
- Create Acces Key
- In .github/workflows
ecr-build-push.yml
- AWS_ACCESS_KEY_ID = (secret)
- AWS_SECRET_ACCESS_KEY = (secret)
- AWS_REGION = ap-southeast-1
- AWS_ACCOUNT_ID = (secret)
- ANSIBLE_CONTROLLER_INSTANCE_ID = (i-ooooyourownec2idoooo)
- docker-compose.yml > USER_NAME=${USER_NAME:-DevOps Engineer} > USER_NAME=${USER_NAME:-Syed Azam}
- git add .- git commit -m "blabla"- git push - index.html
- .nojeklly