Coder Social home page Coder Social logo

terraform-vpc's Introduction

AWS VPC

This code base demonstrates creating a VPC and subnets in AWS using Terraform, Ansible and Packer.

Infrastructure

VPC diagram The Application creates an AWS VPC with the following:

  • 3 AMIs for the frontend, backend, and database instances.
  • A VPC with 3 subnets
    • A public subnet that hosts the frontend of the application.
    • A public subnet that hosts the backend (api base) of the application.
    • A private subnet that hosts the database of the application.
  • An internet gateway to connect the public subnet to the internet
  • A NAT instance in the public frontend subnet to connect the private subnet to the public subnets
  • A frontend instance in the frontend public subnet
  • A backend(API) instance in the backend public subnet
  • A database instance in the private subnet
  • A private route table for the private instance connected to the NAT instance
  • A public route table for the public instances
  • A security group for the public instances
  • A security group for the private instance
  • A security group for the NAT instance

Tools

Getting Started

Setting up the application

Clone the repository

  • git clone https://github.com/davidshare/Terraform-VPC.git

Install Ansible

Install Terraform

Install Packer

Create a free tier AWS account

Create a keypair for a region on your AWS account you just created

Create and get your access keys on your AWS account you just created

Add your environment variables

  • Create a .env file using the env.sample file as a template in the root directory
  • In the ansible directory, create a .env file using the .env.sample file - this file will be copied into the backend directory while provisioning the backend image.

Change the region you want to provision your instance

  • Open the packer_template.json file in the packer directory. In the builders section, replace the values of the region with your own region

     `"region": "eu-west-1"`
    
  • Open the priv_sub.tf, sub1_variables.tf, and sub2_variables.tf files to change the availability zones for the subnets

Deploying

To deploy the application, navigate to the root directory of the cloned repository on the terminal and run bash start.sh

Contributing

  • Clone the repository - git clone https://github.com/davidshare/Terraform-VPC.git
  • Follow the setup process above
  • Create a branch off the develop branch
  • Write your scripts and push to create a pull request
  • Your pull request will be reviewed and then merged

terraform-vpc's People

Contributors

davidshare avatar

Stargazers

 avatar

Watchers

 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.