Skip to content

Ask99Ayush/DriftGuard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DriftGuard

Production-Grade Configuration Drift Detection & Auto-Remediation for AWS

DriftGuard is an infrastructure compliance platform that continuously detects and remediates configuration drift across Linux servers running on AWS. By comparing live system states against a version-controlled baseline, it ensures consistency, security, and operational reliability. Built around secure AWS networking and idempotent automation principles, DriftGuard demonstrates real-world DevOps practices including configuration management, self-healing infrastructure, and automated compliance enforcement.


Production-Grade Architecture Diagram

Architecture Diagram


Table of Contents


Overview

This project implements a centralized configuration management system that ensures consistent server configurations across multiple Linux instances.

The system continuously validates the current state of servers against a defined desired state and performs automated remediation when drift is detected.

It is designed to simulate real-world DevOps workflows used in production environments where consistency, reliability, and automation are critical.


Problem Statement

Managing configurations manually across distributed systems leads to:

  • Configuration drift between servers
  • Inconsistent environments
  • Increased debugging complexity
  • Security vulnerabilities
  • Operational overhead

There is no centralized mechanism to enforce uniform configurations, resulting in unreliable systems.


Solution

This project introduces an automated configuration management approach that:

  • Defines desired system state using structured configuration files
  • Detects configuration drift by comparing actual vs expected state
  • Automatically remediates inconsistencies using scripts
  • Operates within a secure AWS network architecture
  • Enables repeatable and scalable infrastructure management

System Workflow

Developer defines desired configuration

Configuration stored in version control

Scripts executed on target servers

Current state is evaluated

Drift is detected

Remediation logic is triggered

System is restored to desired state


Architecture

The system is deployed within a secure AWS VPC architecture.

Flow:

User → Internet → Bastion Host → Private Servers

Key Design Principles:

  • Only Bastion Host is publicly accessible
  • All application servers remain private
  • Controlled access between layers
  • Outbound internet access via NAT Gateway
  • Security enforced using Security Groups

Refer:


Detailed Component Breakdown

Desired State Configuration

Defines the expected configuration of servers including:

  • Installed packages
  • Running services
  • System settings

Located in:

  • configs/desired-state.yaml

Drift Detection Engine

Compares:

  • Current server state
  • Desired configuration

Identifies mismatches and flags drift.


Auto Remediation Engine

Executes corrective actions such as:

  • Installing missing packages
  • Restarting services
  • Fixing configuration files

Bootstrap Script

Initial setup script responsible for:

  • Preparing server environment
  • Installing dependencies
  • Setting baseline configuration

Features

  • Centralized configuration management
  • Automated drift detection
  • Automatic remediation system
  • Secure AWS-based architecture
  • Repeatable and reliable execution
  • Minimal manual intervention
  • Script-based automation using Bash

Core Concepts

This project demonstrates:

  • Configuration Management
  • Infrastructure as Code mindset
  • Drift Detection
  • Automated Remediation
  • Secure Cloud Networking
  • Bastion-based access control
  • Idempotent system behavior

Project Structure

Project-AWS-Config-Drift-Auto-Remediation-System/
│
├── README.md
├── assets/
├── configs/
├── scripts/
├── deployment/
└── docs/

Documentation

Detailed documentation is available:

These documents provide deeper insights into system design and operational handling.


Execution Flow

Bootstrap Script Execution ↓ System Initialization ↓ Drift Detection Script ↓ State Comparison ↓ Mismatch Identified ↓ Auto Remediation Script ↓ System Corrected ↓ Verification


Sample Output

Example outcomes include:

  • Detection of missing packages
  • Automatic installation of required dependencies
  • Service restart and validation
  • Logs indicating successful remediation

Getting Started

1. Provision Infrastructure

Create AWS resources:

  • VPC
  • Public Subnet
  • Private Subnet
  • Bastion Host
  • EC2 Instances

Refer:

  • deployment/aws-setup.md

2. Connect to Bastion Host

ssh -i key.pem ec2-user@<bastion-public-ip>

3. Access Private Server

ssh -i key.pem ec2-user@<private-ip>

4. Clone Repository

git clone https://github.com/Ask99Ayush/Project-AWS-Config-Drift-Auto-Remediation-System.git
cd Project-AWS-Config-Drift-Auto-Remediation-System/scripts

5. Execute Scripts

chmod +x bootstrap.sh
./bootstrap.sh

chmod +x drift-check.sh
./drift-check.sh

chmod +x enforce-config.sh
./enforce-config.sh

Validation Checklist

  • Desired packages installed
  • Services running correctly
  • No configuration drift detected after remediation
  • Scripts execute without errors
  • Logs generated successfully

Troubleshooting

Refer:

Common checks:

systemctl status nginx
systemctl status docker
cat /var/log/config-management.log

Security Best Practices

  • Restrict SSH access to specific IP addresses
  • Use Bastion Host for controlled access
  • Avoid public exposure of private servers
  • Follow least privilege principles
  • Rotate keys regularly
  • Disable unnecessary ports

Production Considerations

For real-world systems:

  • Replace scripts with Ansible for scalability
  • Use Terraform for infrastructure provisioning
  • Implement centralized logging
  • Add monitoring (CloudWatch, Prometheus)
  • Introduce CI/CD pipelines
  • Use AWS Systems Manager instead of SSH

Future Improvements

  • Integration with Ansible
  • Terraform-based infrastructure automation
  • CI/CD pipeline integration
  • Multi-server orchestration
  • Monitoring and alerting system
  • Dashboard for drift visibility

Author

Ayush Rao Chaudhary

GitHub: https://github.com/Ask99Ayush

LinkedIn: https://linkedin.com/in/Ask99Ayush


Final Note

This project demonstrates how configuration management, automation, and cloud security principles can be combined to build a reliable, scalable, and production-ready system for maintaining server consistency.

About

AWS-based configuration management system that maintains consistent server states across multiple Linux instances. Detects configuration drift by comparing actual vs desired state and performs automated remediation. Designed with secure VPC architecture, Bastion access, and scalable DevOps practices to reduce outages and manual intervention.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages