Skip to content

tlingat/aws-web-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS Web App

Full-Stack AWS Web App

Using Terraform and Ansible, this web application displays any RDS-injected student name and student ID on a web page.

Flask project files are sourced from my former professor's GitHub here

Table of Contents

  1. Background
  2. Guide
  3. Infrastructure and Server Setup
  4. Technologies Used

Background

A simple, full-stack web application fully provisioned using Terraform Modules for the infrastructure and an Ansible Playbook for Host server setups.

Guide

REQUIRED STEPS:

  1. copy the directory using cp -r /local/machine/path/to/my/project /dest/path
    • do NOT use sudo!!
    • if terraform complains about having no permissions, try sudo chmod 777 -R on the project directory after cp
      • THIS SPECIFIC INSTANCE OF sudo LEADS TO PROBLEMS LATER!! (see step 4) ...refrain from doing it!!
  2. cd to backend_setup
    • run terraform init
    • run terraform apply --auto-approve
  3. cd to infra
    • run terraform init
    • run terraform apply --auto-approve
    • this takes a while because of RDS, please be patient!!
  4. cd to service
    • run ansible-playbook setup.yaml
    • if you ended up running it as sudo, the playbook will complain and say that it won't:
      • recognize ansible.cfg
      • fail to see hosts in inventory I am unsure what causes this other than sudo and the ansible directory is too "open" as such
  5. visit web DNS to view webapp
    • found as an output of step 3 above
    • you should see my full name and student ID when visiting the site!

CLEANUP:

  1. cd to infra
    • run terraform destroy
    • enter yes
    • this takes a while because of RDS, please be patient!!
  2. cd to backend_setup
    • run terraform destroy
    • enter yes

NOTES:

  1. this project assumes you have the following:
    • ssh key at ~/.ssh/acit_4640
    • ssh key acit_4640 in AWS EC2
      • us-west-2 (US West Oregon)
    • home IP address (/16) OR range (/24)
      • configurable in ./infra/terraform.tfvars on line 10
    • student name and student ID
      • configurable in ./service/roles/data_injection/tasks/main.yaml on line 56
      • name has a character limit of 30
      • bcit_id has a character limit of 10

Infrastructure and Server Setup

Infrastructure Diagram

The creation of the infrastructure consists of the following AWS resources separated by Modules:

  • S3 Bucket
  • RDS
  • VPC
  • Subnets
  • Route Table
  • Security Groups
  • EC2 Instances

The configuration of the host servers from a dynamic host inventory consists of 4 roles—each with appropriate handlers—in a single Ansible Playbook:

Role Description
be Installs backend and python dependencies for Backend Host, clones Flask project files, configures MYSQL to RDS Host, and creates and starts a new Service
data_injection Installs database dependencies for Backend Host, creates database / user / table, and injects student data to RDS Host
tools Installs base dependencies for Backend and Web Hosts
web Installs web dependencies for Web Host, configures NGiNX proxy, clones Flask project files, and serves index.html

Technologies Used

  • Amazon Web Services - cloud solution for web application
  • Ansible - provisioning automation solution for Host servers
  • DynamoDB - data storage solution
  • Flask - framework for web application provided by former professor
  • HTML - language used for web development
  • Terraform - provisioning automation for infrastructure

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published