Skip to content

Sekhard26/DevopsProject

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automated Deployment of 2-Tier Web Application on AWS

This project shows how I deployed a 2-tier web application on AWS using Terraform, Docker, and Bash scripting. The frontend is built using HTML + CSS, and the backend uses MySQL. The entire infrastructure and deployment process is automated.

Project Overview

The architecture has two tiers:

  1. Frontend (Public Subnet)
  • Static website built with HTML & CSS
  • Hosted on an EC2 instance in the public subnet
  • Accessible through the Internet Gateway
  1. Backend (Private Subnet)
  • MySQL database running inside a Docker container
  • EC2 instance in the private subnet
  • Only accessible from the frontend instance

What I Automated

Created a complete VPC using Terraform

  • Public subnet for frontend, private subnet for backend
  • Configured Internet Gateway + NAT Gateway
  • Added route tables and associations
  • Launched EC2 instance for frontend (HTML/CSS site)
  • Launched EC2 instance for backend (MySQL container)
  • Implemented bastion host for SSH access
  • Wrote Bash scripts for:
  • Starting frontend
  • Setting up MySQL
  • Automating service start
  • Stored Terraform state remotely for reproducible deployments

Tools & Technologies Used

  • AWS EC2, VPC, Subnets
  • Terraform (IaC) = Docker
  • MySQL
  • HTML + CSS (Frontend UI)
  • Bash Scripting
  • Security Groups
  • NAT Gateway, Internet Gateway

File-Structure

2Tier-DevOps-Project/
|-- app/
|   |-- backend/
|       │-- index.html
|       │-- style.css
|				|-- Dockerfile
|	  		|-- script.js
|   |-- frontend/
| 			|-- Dockerfile
| 			|-- server.js
│-- terraform/
│   │-- main.tf
│   │-- vpc.tf
│   │-- frontend.sh
│   │-- backend.sh
│   │-- variables.tf
│   │-- outputs.tf

How to Deploy

  1. Initialize Terraform
  • terraform init
  1. Validate
  • terraform validate
  1. Preview deployment
  • terraform plan
  1. Apply
  • terraform apply

Terraform will create everything:

  • VPC
  • Subnets
  • EC2 instances
  • NAT + IGW
  • Security groups
  • Then your Bash scripts will:
  • Start frontend (HTML/CSS)
  • Deploy MySQL container
  • Initialize database

What I Learned

  • How to deploy a 2-tier architecture on AWS
  • Using Terraform to automate cloud infrastructure
  • Working with public & private subnets
  • Deploying a static website on EC2
  • Running MySQL inside Docker
  • Writing automation scripts using Bash
  • Using security groups to control access

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HCL 53.5%
  • HTML 17.0%
  • JavaScript 15.5%
  • Shell 8.9%
  • Dockerfile 5.1%