Code Monkey home page Code Monkey logo

aws-ec2-web-application's Introduction

aws-ec2-web-application

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage

About The Project

This project is built to host a PHP application in AWS EC2 instance.

Built With

The project is built using,

  • AWS resources
  • Terraform
  • Ansible

Getting Started

Prerequisites

  • Create a free tier AWS account.
  • Create an IAM user with programmable access and make a note of the access and secret keys.

Installation

  1. Clone the repo
    git clone https://github.com/listentolearn/aws-ec2-dynamic-website
  2. Install Terraform
  3. Install Ansible

Usage

Hosting this application involves three parts.

Part 1: Standing up the Infrastructure

The infrastructure is setup in AWS using Terraform.

  1. cd into the infrastructure folder in the cloned repository.
  2. Run the following commands in order
    • terraform init
    • terraform plan
    • terraform apply

This will provision the required infrastructure and provides the EC2 instance public IP as the output.

Part 2: Installing the application

The next step is to install the required softwares in the EC2 instance and deploy the php application along with the MySQL database. This is done using ansible.

  1. Open the inventory.yml file under ansible directory and replace 0.0.0.0 with the public IP copied at the end of part 1.
  2. Replace the contents of the ./ansible/secrets/ssh.private with your private key. This is the private key corresponding to the public key used in Part 1 while provisioning the infrastructure using terraform.
  3. Run the ansible playbook using the below command
    • ansible-playbook -i inventory.yml application.yml

Part 3: Tear down the application

Run the below command to tear down the application.

- terrafrom destroy

aws-ec2-web-application's People

Contributors

listentolearn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.