ValAug / aws-compu-terraform

Deploy AWS-EC2s with Terraform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aws-compu-terraform

Create and deploy multiple different type of AWS EC2-AMIs with Terraform

Cloud - ☁️

AWS

IaaC

Terraform

AWS EC2s-AMIs diagram

alt text

Purpose

Shows how to use AWS with Terraform to accomplish the following tasks:

  • How to build multiple different type of AWS EC2-AMIs dynamically

Prerequisites

  • You must have an AWS account, and have your default credentials and AWS Region configured
  • You must have Terraform installed

Cautions

  • As an AWS best practice, grant this code least privilege, or only the permissions required to perform a task. For more information, see Grant Least Privilege in the AWS Identity and Access Management User Guide.
  • This code has been tested in us-west-1 AWS Regions only. However it should work in any other region.
  • Running this code it will result in charges to your AWS account.

How to run this code

Quick Start

It will deploy to the account setup for the aws cli called 'default'

cd aws-compu-terraform
terraform init
terraform validate
terraform apply --auto-approve

Quick Destroy

terraform destroy --auto-approve

Notes

  • clone this Git repo
  • cd to the the directory aws-compu-terraform.
  • use terraform init command to initialize the Terraform working directory and to download plugins for a provider (aws)
  • terraform validate command will validate the code before actual deployment
  • terraform plan command will show the execution code before making the actual deployment
  • terraform apply
  • Alternate command : terraform apply -auto-approve
  • terraform destroy
  • Alternate command : terraform destroy -auto-approve
  • terraform fmt -recursive # A way to format the terraform code

About

Deploy AWS-EC2s with Terraform


Languages

Language:HCL 100.0%