Answers for "terraform script to create ec2 instance"

3

aws instance creation using terraform

resource "aws_instance" "myec2" {
  ami                    = "<AMI-ID>"
  instance_type          = "t2.micro"
  vpc_security_group_ids = ["SECURITY-GROUP-ID"]
  key_name               = "<KEY-NAME>"
  subnet_id              = "<SUBNET ID>"
  iam_instance_profile = "<ROLE NAME>"

  tags = {
    Name = "<PUT THE NAME>"
  }
}
Posted by: Guest on September-12-2020
1

terraform script to create ec2 instance

module "ec2_cluster" {
  source                 = "terraform-aws-modules/ec2-instance/aws"
  version                = "~> 2.0"

  name                   = "my-cluster"
  instance_count         = 5

  ami                    = "ami-ebd02392"
  instance_type          = "t2.micro"
  key_name               = "user1"
  monitoring             = true
  vpc_security_group_ids = ["sg-12345678"]
  subnet_id              = "subnet-eddcdzz4"

  tags = {
    Terraform   = "true"
    Environment = "dev"
  }
}
Posted by: Guest on March-23-2021
-1

create aws ec2 instance using terraform

#create aws ec2 instance using terraform
provider "aws" {
  region = "ap-south-1"

}
resource "aws_instance" "ec2" {
  ami = "ami-019f0583716f0aec4" //ap-south-1
  instance_type = "t2.micro"
  tags = {
    Name = "visualscrapy"
  }
}
#you can get the ami-id from amzon marketplace
Posted by: Guest on May-26-2021

Code answers related to "terraform script to create ec2 instance"

Browse Popular Code Answers by Language