Code Monkey home page Code Monkey logo

create-ec2-with-new-vpc-terraform's Introduction

Create a EC2 Instance with a New VPC on AWS using Terraform

I made this Project so I would not have to keep writing code. Please enjoy.

If for whatever reason you find something wrong, incorrect, invaild, or no-longer applies to the current version. Please make a Issue or a PR Thank you.

P.S. I also did this, so I can learn on my off time. 10,000 Hours to Master a Skill, it all starts with the first hour.

Diagram of This Project

This Terraform Project/Module is specific to AWS ~

Be Advised this is for AWS

Setup

Please preform these Actions on a WSL Ubuntu or Linux console

  • ssh-keygen -t rsa -f <Replace with your Key Name> -P ""
    • This will Create a SSH Key that can be used to Access the EC2 Instance.
  • chmod 400 <Replace with your Key Name>*
    • This will set the proper permissions so you can use them.
  • Open PuttyGen at this time, at the Top Click Conversions -> Import Key
  • Select the Key that you Just Generated, the one that does not end with .pub
  • Click Save out Public/Private Key seperate which will generate your *.ppk file to load into Pagent
  • Open Pagent
  • Double click on the <Replace with your Key Name>.ppk file which will load it into Pagent
    • This allows Putty to automatically Access it for loggin in.

Settings

Edit the Settings Located in terraform.tfvars if you need to have production.tfvars or develop.tfvars please use Command style (B)

  • env = "demonstration"
    • This is what Envirnoment that it resides in. Production? Development? Staging? Dinosaur?
  • project = "ec2_demo_example"
    • This is the name of the Project, keep it locase with no spaces and no special symbols besides _ makes it easier to query in CLI/Terraform.
  • instance_type = "t2.micro"
    • This is the side of the Instance, A.K.A. How much do you want to spend?
  • region = "us-west-1"
    • Region your EC2 Resides in. I'm West Coast so like.. Yeah.
  • key_file = "filename"
    • This is the filename of the Key.pub you generated in Setup. This can be /location/to/file.pub.

How-to Run

  • Command Style (A) with terraform.tfvars
    • terraform init
    • terraform plan -out <Name for your Plan>
    • terraform apply "<Name for your Plan>"
  • Command Style (B) with a Custom *.tfvars File.
    • terraform init
    • terraform plan -out <Name for your Plan> -var-file <Name of Config>.tfvars
    • terraform apply "<Name for your Plan>"
  • To Destroy it all type: ``

How-to Login your new EC2 Instance~ (Windows)

  • Open Putty
  • Put your server_public_ip that is listed, make sure port is 22
  • Go to Connection -> Data and fill-in the Auto-login username Field with ubuntu
  • Go to Connection put 1 inside of the Seconds between keepalives
  • Check the Enable TCP keepalives Box
  • Go to Session
  • Type in a name for this EC2 Session in the Saved Sessions Box
  • Click Save
  • Double Click on the Name you just typed. And Enjoy your Connection
  • If it asks you to accept a SSL Cert, click yes.
  • Your Welcome <3

Lazy Settings

  • .env
    • KEY_FILE
      • Name of the Key file you will be generating ssh_keygen.
    • PLAN_NAME
      • Name of the Plan you will be generating with Terraform.

Make File

Made this due to being Lazy..... Sorry.... Or wait, your welcome I mean ;)

  • make init
  • make plan
  • make apply
  • make destroy
  • make genkey
  • make graph

Created by: Randolph Bioblaze Payne Aarseth

create-ec2-with-new-vpc-terraform's People

Contributors

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