Coder Social home page Coder Social logo

terraform-aws-vpc's Introduction

Terraform AWS VPC

๐Ÿ“ฆ Install Terraform

Install Terraform by following the documentation

Make sure terraform is working properly

$ terraform
Usage: terraform [--version] [--help] <command> [args]

The available commands for execution are listed below.
The most common, useful commands are shown first, followed by
less common or more advanced commands. If you're just getting
started with Terraform, stick with the common commands. For the
other commands, please read the help and docs before usage.

Common commands:
    apply              Builds or changes infrastructure
    console            Interactive console for Terraform interpolations
# ...

Based on standard module structure guidelines

๐Ÿ“ Naming Convention

Common variables referenced in naming standards

Variable RegExp Example
<availability_zone> [a-z]{2}-[a-z]{1,}-[1-2][a-f] us-east-1a, us-west-2c, eu-west-1a, ap-northeast-1c

AWS - Resource Naming Standards

AWS Resource Resource Naming Comment Example
VPC <vpc_name>-vpc mycloud-vpc
Subnets <vpc_name>-private-<availability_zone> mycloud-private-us-east-1b
<vpc_name>-public-<availability_zone> mycloud-public-us-east-1b
Route Tables <vpc_name>-private-<availability_zone> mycloud-private-us-east-1b
<vpc_name>-public mycloud-public
Internet Gateway <vpc_name>-igw mycloud-igw
Nat Gateway <vpc_name>-nat-<availability_zone> mycloud-nat-us-east-1b

1. Create a VPC

The really first stage for bootstrapping an AWS account is to create a VPC

VPC AZs

2. Create public and private Subnets

Then create public and private subnets in each AZs (us-east-1a, us-east-1b, us-east-1c)

VPC AZs Subnets

3. Create internet and nat Gateways

Create one internet gateway so that the VPC can communicate with the outisde world. For instances located in private subnets, we will need NAT instances to be setup in each availability zones

VPC AZs Subnets GW

4. Create route tables and routes

Finaly, link the infrastructure together by creating route tables and routes so that servers from public and private subnets can send their traffic to the respective gateway, either the internet gateway or the NAT ones.

VPC AZs Subnets GW Routes

Tips and Tricks

  • Connect to AWS private instance using a NAT server as a jumphost
eval $(ssh-agent)
ssh-add <keypair.pem>
ssh -i key-pair/aws-educate-student.pem -J ec2-user@<public-NAT-IP> -A ec2-user@<private-EC2-IP>

terraform-aws-vpc's People

Contributors

lowess avatar

Stargazers

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