Create AWS EC2 Instance using Terraform.

Create AWS EC2 Instance using Terraform

What is Terraform ?

Now let’s discuss where it is used?

1.Download Terraform

terraform -v

Configure AWS

aws configure — profile “name”

Build EC2 instance

Configure to terraform.

provider "aws" {
region = "ap-south-1"
profile = "shubham"
$ terraform init

Create EC2 instance

resource "aws_instance" "myFirstInstance" {
ami = "ami-0447a12f28fddb066"
instance_type = "t2.micro"
tags = {
Name = "server"


output "Server_instance"{

How to run code?

$ terraform validate
$ terraform apply

How to delete all infrastructure?

$ terraform destroy


DevOps Engineer at Mindbowser Inc|