Code Monkey home page Code Monkey logo

terraform-simple-infrastructure's Introduction

Simple Application Infrastructure

Terraform is a perfect language to create and manage products infrastructure. It has a declarative way to create templates, so you just have to describe how you want your application to be, and terraform will find out the steps that needs to be done to the infrastructure be exacly how you want to.

This template will create a simple infrastructure to an application.

How the infrastructure will be:

First of all, it will create a virtual private cloud (VPC) to provision an isolated, fully manageable cloud environment.

This VPC will be connected to an Internet Gateway, that allow the VPC to receive requests from the internet.

The created VPC is divided in two subnets:

  • The public subnet can be access by the whole internet. It could be used to host frontend's applications.
  • The private subnet only receive requests of the applications hosted on our public subnet, increasing the security of our application. It could host our backend and database aplications using a cluster kubernetes.

Each subnet has the routing table configured, and an instance deployed with security groups already defined.

The private subnet have an NAT gateway attached to make possible the instance reach the internet when needs to download or update the softwares

How to use

To run terraform and create this infrastructure on your AWS is just run the commands below:

First of all you need to init terraform using the command below, this will download the requirements to communicate with the providers, in this case, AWS.

terraform init

This command will check the terraform template and show you everything that will be created when you apply the template.

terraform plan -var="aws_access_key=YourAccessKey" -var="aws_secret_access_key=YourSecretAccessKey"

This command will create the infrastructure on your AWS.

terraform apply -var="aws_access_key=YourAccessKey" -var="aws_secret_access_key=YourSecretAccessKey"

If you want just to test the template and see in the AWS Console everything that this template creates, after this you can destroy everything simply running this command.

terraform destroy

To do's

  • Set AutoScaling to the instances.
  • To the application have more availability, create the application in more availability zones.

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.