Skip to content

574n13y/Aws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aws

Website

Aws using Iaac Tool ie Terraform

POC

Choosing Provider, region, machine type, instance type, no of instances, vpc.
terraform init ---> The terraform init command initializes a working directory containing Terraform configuration files.

1

terraform plan ----> Reviewing Plans
terraform apply ----> Applying them

2

output

3

terraform destroy --->Destroying and preview the changes in terraform

4

Output

5

Code

6

main.tf

provider "aws" {
  region = "ap-northeast-1"
}
resource "aws_vpc" "example" {
  cidr_block = "10.0.0.0/16"
}
resource "aws_instance" "ec2" {
  ami           = "ami-06323ff1c3178cee1"
  instance_type = var.list[3]
  tags = {
    name = "Windows_Server-${count.index}"
  }
  count = 5

}
variable "list" {
  type    = list(any)
  default = ["m5.large", "m5.xlarge", "t2.medium", "t2.mirco"]
}

variable "types" {
  type = map(any)
  default = {
    ap-south-1     = "t2.micro"
    us-west-2      = "t2.nano"
    ap-northeast-1 = "t2.micro"
    us-west-1      = "t2.small"
  }
}

init, fmt, plan , apply, destroy