Giter Club home page Giter Club logo

learning-aws-vpc's Introduction

learning-aws-vpc

This repo is used to explore AWS VPC using Terraform

We will explore a few different AWS scenarios from here.

Scenario 1

  • scenario-1-public

This subfolder is a replica of the AWS docs Scenario 1. This terraform config will create a simple VPC with a single instance in a public subnet.

Setup

First, need to export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

Next, create a scenario-1-public/override.tf file the following as the contents:

resource "aws_key_pair" "dev" {
  key_name = "dev-key"
  public_key = "CHANGE ME TO THE CONTENT OF YOUR PUBLIC SSH KEY"
}

Now you can try it out:

$ cd scenario-1-public
$ terraform plan
$ terraform apply
...

State path: terraform.tfstate

Outputs:

  eip_01 = XX.XXX.XX.XXX

After some amount of time, you should get an Ouputs like above. You should be able to ssh to that instance now:

Scenario 2

  • scenario-2-public-private

This subfolder is a replica of the AWS docs Scenario 2. This terraform config will create a simple VPC with an instance in a public subnect, an instance in a private subnet and a NAT instance.

Setup

First, need to export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

Next, create a scenario-2-public-private/override.tf file the following as the contents:

resource "aws_key_pair" "dev" {
  key_name = "dev-key"
  public_key = "CHANGE ME TO THE CONTENT OF YOUR PUBLIC SSH KEY"
}

Now you can try it out:

$ cd scenario-2-public-private
$ terraform plan
$ terraform apply
...

State path: terraform.tfstate

Outputs:

  db_01_ip   = xx.XXX.xx.XXX
  nat_01_eip = yy.YYY.yy.YYY
  web_01_eip = zz.ZZZ.zz.ZZZ

After some amount of time, you should get an Ouputs like above. You should be able to ssh to that instance now:

You will NOT be able to ssh to the instance in the private subnet (db_01)

Notice

Because this launches real instances, you may be charged for usage. Be sure to run terraform destroy in each of the folders that you do a terraform apply in.

I'm not responsible for any balances you build up!

Planned Features

  • AWS Scenario 1
  • AWS Scenario 2
  • VPN into vpc
  • Custom internal dns

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.