Skip to content

AhmadProjects-git/Autonomous-SelfHealing-Infrastructure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 Autonomous Self-Healing Infrastructure using AWS + Terraform + Nginx

This project showcases how to build a fully automated and self-healing web server infrastructure on Amazon Web Services (AWS) using Terraform. If any EC2 instance fails or is terminated, the Auto Scaling Group (ASG) automatically recreates it β€” ensuring zero downtime and high availability.


πŸš€ Features

βœ… Fully automated AWS infrastructure provisioning via Terraform βœ… Self-healing EC2 instances using Auto Scaling Groups βœ… Application Load Balancer (ALB) for traffic distribution βœ… Nginx web server auto-installed using a user data script βœ… Built entirely as Infrastructure as Code (IaC) βœ… Modular, reusable Terraform configuration


🧩 Project Structure

Autonomous-SelfHealing-Infrastructure/
β”‚
β”œβ”€β”€ main.tf            # Core infrastructure definitions
β”œβ”€β”€ provider.tf        # AWS provider configuration
β”œβ”€β”€ variables.tf       # Input variables (region, AMI, instance type, etc.)
β”œβ”€β”€ security.tf        # Security group and firewall rules
β”œβ”€β”€ vpc.tf             # VPC, subnets, and networking configuration
β”œβ”€β”€ userdata.tpl       # Nginx auto-installation and sample HTML page
β”œβ”€β”€ outputs.tf         # ALB DNS output after deployment
β”œβ”€β”€ .terraform.lock.hcl# Terraform dependency lock file
└── README.md          # Project documentation

βš™οΈ Prerequisites

Before you begin, make sure you have the following:

  • ☁️ AWS Account (with administrative permissions)
  • πŸ’» AWS CLI installed and configured locally
  • 🧱 Terraform v1.x installed
  • πŸ”— Git installed

πŸͺœ Setup Instructions

Step 1: Clone the Repository

git clone https://github.com/AhmadProjects-git/Autonomous-SelfHealing-Infrastructure.git
cd Autonomous-SelfHealing-Infrastructure

Step 2: Initialize Terraform

terraform init

Step 3: Review the Plan

terraform plan

Step 4: Deploy the Infrastructure

terraform apply -auto-approve

βœ… Terraform will:

  • Create a VPC, subnets, and security groups
  • Launch an EC2 Auto Scaling Group with Nginx installed
  • Configure and attach an Application Load Balancer
  • Output the ALB DNS endpoint

🌐 Step 5: Access Your Application

Once deployment completes, Terraform will output something like:

alb_dns_name = selfheal-alb-1234567890.us-east-1.elb.amazonaws.com

Open that URL in your browser 🌍 You’ll see a green β€œNginx + Terraform + AWS” webpage β€” confirming successful deployment βœ…


🧠 Step 6: Test the Self-Healing Capability

  1. Log in to the AWS Console β†’ EC2 β†’ Instances
  2. Manually terminate the running instance 🧨
  3. Watch the Auto Scaling Group automatically launch a new instance 🎯

Your application will remain available throughout β€” no downtime!


🧹 Step 7: Clean Up Resources

When you’re done testing, destroy all resources to avoid costs:

terraform destroy -auto-approve

🧰 Technologies Used

  • AWS EC2, VPC, ALB, Auto Scaling Groups
  • Terraform (IaC)
  • Nginx Web Server
  • User Data scripting

πŸ‘¨β€πŸ’» Maintainer

Developed by: @AhmadProjects-git 🌐 GitHub Repository: Autonomous-SelfHealing-Infrastructure


πŸ’¬ Support & Contributions

πŸ’‘ Found an issue or have ideas to improve?


Happy Automating! πŸ€–βš™οΈ Build resilient, self-healing, and autonomous cloud systems β€” the DevOps way! 🌩️


🏁 License

This project is licensed under the MIT License. You’re free to use, modify, and distribute it β€” just give credit πŸ’™


About

πŸš€ Build an autonomous, self-healing AWS infrastructure using Terraform and Nginx. Automatically recover failed EC2 instances with Auto Scaling and Load Balancing β€” ensuring zero downtime and high availability β˜οΈπŸ’‘

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors