This project demonstrates a hybrid Infrastructure as Code (IaC) approach where:
- Terraform provisions AWS infrastructure
- Ansible configures EC2 instances
- Nginx is installed and a custom web page is deployed automatically
- Terraform
- Ansible
- AWS EC2, VPC
- Ubuntu Linux
- Nginx
-
Terraform creates:
- A VPC
- Two public subnets
- Two EC2 instances
-
Terraform generates a dynamic inventory for Ansible.
-
Ansible connects to EC2 and:
- Installs Nginx
- Deploys custom
index.html
- AWS account
- AWS CLI configured
- Terraform installed
- Ansible installed
cd terraform
terraform init
terraform apply
cd ../ansible
ansible-playbook -i inventory.ini site.ymlTwo public IPs showing different Nginx web pages.
Save it.
To avoid leaking secrets and state files.
nano .gitignore- In main.tf SSH should be restrict to your IP.(for Testing purpose ssh from anywhere is ok)


