Coder Social home page Coder Social logo

ec2_website's Introduction

Python Django Website Deployed Via Terraform On EC2 Instance

Automatic deployment and management of a Django website using Docker, Terraform, and EC2 instances in AWS.

What, Why, How

  • What? This is a Terraform stack to construct, deploy and manage a website with EC2 instances.

  • Why? To demonstrate running a simple website in AWS on an EC2 instance.

  • How? This repo contains the Docker Compose files to run a Django website locally and also in AWS on an EC2 instance.

Prerequisites

  • AWS profile configuration and credentials set. AWS CLI Configuration User Guide
  • AWS Region specified in ./terraform/variables.tfvars file.
  • Optional Namespace setting for your stack set in ./terraform/variables.tfvars.

Quickstart One Step Deploy

Set the prerequisite information, and then from the root of this repo, run:

make apply

This will begin the Terraform process in your AWS account and region specified in the ./terraform/variables.tfvars file noted above in the prerequisites. The image used in the EC2 instance to run the website can be found on Docker Hub at nungster/ec2_website or pulled via

docker pull nungster/ec2_website:latest

Implementation details

The stack created by this terraform module is composed of:

  • Compute
    • EC2 instance
  • Network
    • Virtual Private Cloud
    • Internet Gateway
    • Security Group
    • Subnet
  • Security
    • SSH Key Pair

Input/Output

Input

Name Description Type Default Required
aws-profile The name of the AWS shared credentials account. string aws-profile yes
aws-region The AWS region string aws-region yes

Outputs

Name Description
browser_connection_string The URL of the website
ssh_connection_string SSH connection string to the webserver

ToDo's

  • Split out Database to RDS
  • Use ECR for Docker image Repository instead of a public repo
  • IAM roles and policies to allow EC2 instances to read and pull ECR images
  • Implement load balancing and ability to use more EC2 instances

ec2_website's People

Contributors

nungster avatar

Watchers

 avatar  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.