Skip to content

jay-jain/aws-terraform

Repository files navigation

Terraform with AWS Examples

Pre-requisites

An AWS Account

You will need to sign up for an AWS account. These examples are meant for Free Tier (the 12-month free trial in AWS). You will need to go in the IAM console and create a user account and download the credentials. From these credentials, you will need the Access Key ID and Secret Access Key in the next step.

AWS CLI - Windows

Git-SCM

  • Install Git-SCM: https://git-scm.com/download/win

  • You will now need to generate a ssh keypair with the following command in Git Bash: ssh-keygen.exe -t rsa

  • You should name the keypair terraform or whatever you like. It should save two files in the .ssh directory in your home folder.

  • It will save a public key called terraform.pub and a private key called terraform.

  • Make sure that you modify the path of the location for your ssh public and private keys in your terraform scripts.

Terraform

Running Terraform Scripts

  • If it is your first time running a particular terraform script, navigate to the directory to where your script is located and execute the following command in PowerShell or CMD: terraform init

  • If you want to format your .tf file you can use the following command: terraform fmt

  • To create the terraform plan, run: terraform plan

  • To execute the terraform plan, run: terraform apply

    • Type yes at the prompt to confirm the launch of cloud resources.
  • After you run terraform apply I recommend going into the AWS console and visually make sure that all the resources specified in your script have been launched.

  • Always remember to destroy your resources, so that you do not get charged excessively by your cloud provider

    • To do this, run: terraform destroy

    • Type yes at the prompt to confirm the destroy.

  • Go into the AWS console to make sure that all the resources have been destroyed

About

Terraform examples with AWS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published