Create EC2 -Instance : Exercise 1

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Code :

# Terraform Settings Block
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      #version = "~> 3.21" # Optional but recommended in production
    }
  }
}

# Provider Block
provider "aws" {
  profile = "default" # AWS Credentials Profile configured on your local desktop terminal  $HOME/.aws/credentials
  region  = "ap-south-1"
}

# Resource Block
resource "aws_instance" "ec2demo" {
  ami           = "ami-074dc0a6f6c764218" # Amazon Linux in us-east-1, update as per your region
  instance_type = "t2.micro"
}


Comments

Popular posts from this blog

Terraform : AWS : Terraform on AWS with SRE & IaC DevOps | Section 2 : Terraform basics

Terraform : AWS : Terraform on AWS | Section 4: Terraform Input Variables and Datasources

Terraform VPC - on AWS : Three tier architecture design