Skip to content

Terraform and Ansible project for setting up a secure web infrastructure on AWS.

Notifications You must be signed in to change notification settings

ahmedelzagh/AWS-secure-web-infra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AWS Secure Web Infrastructure

This project sets up a secure web infrastructure on AWS using Terraform and Ansible. It includes VPC, subnets, EC2 instances, security groups, and a Bastion host. Ansible is used to configure Nginx on the EC2 instances.

Project Structure

.
├── .gitignore
├── .vscode/
│   └── settings.json
├── ansible/
│   ├── inventory
│   ├── nginx_setup.yml
│   └── roles/
│       └── nginx/
│           └── tasks/
│               └── main.yml
├── terraform/
│   ├── main.tf
│   ├── outputs.tf
│   ├── variables.tf
│   └── modules/
│       ├── vpc/
│       │   ├── main.tf
│       │   ├── variables.tf
│       │   └── outputs.tf
│       ├── ec2/
│       │   ├── main.tf
│       │   ├── variables.tf
│       │   └── outputs.tf
│       ├── bastion/
│       │   ├── main.tf
│       │   ├── variables.tf
│       │   └── outputs.tf
│       └── security_groups/
│           ├── main.tf
│           ├── variables.tf
│           └── outputs.tf
└── README.md

Prerequisites

Terraform Setup

  1. Initialize Terraform:

    cd terraform
    terraform init
  2. Apply Terraform Configuration:

    terraform apply

    This will create the VPC, subnets, EC2 instances, security groups, and Bastion host.

Ansible Setup

  1. Update Inventory File:

    Update the inventory file with the public and private IPs of the EC2 instances.

  2. Run Ansible Playbook:

    ansible-playbook -i ansible/inventory ansible/nginx_setup.yml

    This will install and start Nginx on the EC2 instances.

Outputs

After running Terraform, the following outputs will be available:

  • VPC ID
  • Public Subnet ID
  • Private Subnet ID
  • Public EC2 Instance ID and Public IP
  • Private EC2 Instance ID
  • Bastion Host ID and Public IP
  • Security Group IDs

Clean Up

To destroy the infrastructure, run:

terraform destroy

About

Terraform and Ansible project for setting up a secure web infrastructure on AWS.

Topics

Resources

Stars

Watchers

Forks

Languages