Skip to content

About

This project implements a fully automated cloud-based infrastructure using OpenTofu and Ansible to provision and configure resources on AWS.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

117 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

InfrastructureProject

This project implements a fully automated cloud-based infrastructure using OpenTofu and Ansible to provision and configure resources on AWS. It’s designed to be secure, scalable, and fully managed using Infrastructure as Code (IaC).


👥 Collaboration Note

This project was developed as part of a team during our DevOps course. We collaborated closely on all aspects — infrastructure provisioning, automation, and application deployment. All team members, including myself, contributed equally and worked together on every part of the project.

🔍 Project Background

We were given a situation that our team has been hired as consultants to design and deliver a scalable infrastructure for a client’s web service. The client expects a secure solution deployed and maintained via automation.


🛠️ Tools Used

  • AWS CloudShell – Used to run everything directly in AWS
  • OpenTofu – Infrastructure as Code tool to provision AWS resources
  • Ansible – Configuration management and app deployment

🚀 How to Deploy the Project

✅ Requirements

  • AWS account (with CloudShell access)
  • GitHub account

📦 Deployment Steps

  1. Open CloudShell from AWS Console

  2. Create an SSH key (if not already created):

    ssh-keygen -t rsa -b 4096 -C "aws-instance" -f ~/.ssh/InfraProj-cocloudshell-key -N ""
  3. Add the public key to GitHub

  • View the key:
    cat ~/.ssh/InfraProj-cocloudshell-key.pub
  • Copy the key
  • Then go to GitHub → ⚙️ Settings → SSH and GPG keys → New SSH key and paste it.
  1. Start SSH agent and add your key
    eval $(ssh-agent -s)
    ssh-add ~/.ssh/InfraProj-cocloudshell-key
  1. Clone the repository using SSH
    git clone git@github.com:almafrank/InfrastructureProject.git
    cd InfrastructureProject
  1. Run the script
   chmod +x install.sh
    ./install.sh

🔧 What the Script Does The install.sh script automates:

  • Installing OpenTofu and running
  • Generating or using an existing SSH key
  • Updating terraform.tfvars with your current IP
  • Updating Ansible inventory using Terraform outputs
  • Replacing IPs in the inventory and playbooks
  • Installing Ansible
  • Running playbooks to configure servers
  1. Accessing the Application Once the script finishes and the app is deployed, open EC2 in AWS -> Load Balancers -> Copy Load Balancer DNS name -> Open in web browser:

📁 Project Structure

    InfrastructureProject/
    ├── Ansible/
    │   ├── app_setup.yml
    │   ├── inventory
    │   ├── postgres_setup.yml
    │   ├── python_setup.yml
    │   └── files/
    │       └── app.py
    ├── OpenTofu/
    │   ├── main.tf
    │   ├── output.tf
    │   ├── terraform.tfvars
    │   └── variable.tf
    ├── install.sh
    └── README.md

About

This project implements a fully automated cloud-based infrastructure using OpenTofu and Ansible to provision and configure resources on AWS.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages