create an ec2 instance in North Virginia region that's publicly accessible in Terraform code that meets the following specifications: 

- allows all inbound SSH
- allows egress to all
- latest Amazon Linux 2 image, gp2 compatible
- instance type t3.micro

also add other necessary resources and config in the code
system
uttar varjeenia kshetra main ek EC2 udhaaharan banaaen jo ki Terraform code main saarvajanik rup se sulabh he jo nimna vishistataaon ko puraa karata he:

- sabhi inbound SSH kii anumati detaa he
- sabhi ko egres kii anumati detaa he
- naveenatam amejan linaks 2 chhavi, GP2 sangat
- udhaaharan prakaar t3.micro

anya aavashyak sansaadhan bhi joden or code main configar karen
user
zarur!yahaan terraform code he jo uttari varjeenia (yues-east -1) kshetra main ek EC2 udhaaharan banaata he jo nirdisht aavashyaktaaon ko puraa karata he:

`` `
terraform {

  # note: us sanskaran ke saath badalen jisaki aapako aavashyaktaa he yaa upyog karen
  aavashyak_varjan = "> = 1.2.0"

  aavashyak_prowiders {
    aws = {
      strot = "Hashicorp/aws"
      # note: us sanskaran ke saath badalen jisaki aapako aavashyaktaa he yaa upyog karen
      sanskaran = "~> 4.16"
    }
  }
}

# pradaata or kshetra ko paribhaashit karen
pradaata "AWS" {
  kshetra = "yues-east -1"
}

# naveenatam amejan linaks 2 chhavi ko punah praapt karen jo GP2 sangat he
data "AWS_AMI" "Amazon_linux_2" {
  MOST_RECENT = TRUE

  filter {
    naam = "naam"
    maan = ["AMZN2-AMI-HVM-2.0.*-x86_64-GP2"]
  }

  filter {
    naam = "rajya"
    maan = ["uplabdh"]
  }
}

# EC2 udhaaharan ke liye ek suraksha samooh banaaen kisi bhi IP se SSH kii anumati dene ke liye or kisi bhi IP ke liye sabhi port ko Egress
sansaadhan "aws_security_group" "ec2_sg" {

  Ingress {
    vivaran = "kahin se bhi ssh"
    from_port = 22
    to_port = 22
    protocol = "tisipi"
    cidr_blocks = ["0.0.0.0/0"]
  }

  egress {
    vivaran = "kahin bhi ke liye"
    from_port = 0
    to_port = 0
    protocol = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

# ek EC2 udhaaharan banaaen
sansaadhan "aws_instance" "namoona" {
  ami = data.aws_ami.amazon_linux_2.image_id
  udhaaharan_tip = "t3.micro"
  suraksha_grups = [AWS_SECURITY_GROUP.EC2_SG.NAME]
}

`` `

is code main, ham pehle terraform or AWS pradaata sanskarnon ko paribhaashit karte hai, phir pradaata ko AWS hone ke liye nirdisht karte hai or sansadhano ko "US-EAST-1" (uttari varjeenia) kshetra main tainaat karte hai.

phir, ham ek suraksha samooh banaate hai jo sabhi inbound esaech or sabhi outbound trekkic kii anumati detaa he.

ant main, ham naveenatam amejan linaks 2 chhavi, "T3.Micro" udhaaharan prakaar ke saath ek EC2 udhaaharan ko paribhaashit karte hai, or suraksha samooh ko isamen sanlagn karte hai.

mujhe aashaa he ki vah madad karenge!
assistant
<|system|>
</s>
<|user|>
uttar varjeenia kshetra main ek EC2 udhaaharan banaaen jo ki Terraform code main saarvajanik rup se sulabh he jo nimna vishistataaon ko puraa karata he:

- sabhi inbound SSH kii anumati detaa he
- sabhi ko egres kii anumati detaa he
- naveenatam amejan linaks 2 chhavi, GP2 sangat
- udhaaharan prakaar t3.micro

anya aavashyak sansaadhan bhi joden or code main configar karen</s>
<|assistant|>
zarur!yahaan terraform code he jo uttari varjeenia (yues-east -1) kshetra main ek EC2 udhaaharan banaata he jo nirdisht aavashyaktaaon ko puraa karata he:

`` `
terraform {

  # note: us sanskaran ke saath badalen jisaki aapako aavashyaktaa he yaa upyog karen
  aavashyak_varjan = "> = 1.2.0"

  aavashyak_prowiders {
    aws = {
      strot = "Hashicorp/aws"
      # note: us sanskaran ke saath badalen jisaki aapako aavashyaktaa he yaa upyog karen
      sanskaran = "~> 4.16"
    }
  }
}

# pradaata or kshetra ko paribhaashit karen
pradaata "AWS" {
  kshetra = "yues-east -1"
}

# naveenatam amejan linaks 2 chhavi ko punah praapt karen jo GP2 sangat he
data "AWS_AMI" "Amazon_linux_2" {
  MOST_RECENT = TRUE

  filter {
    naam = "naam"
    maan = ["AMZN2-AMI-HVM-2.0.*-x86_64-GP2"]
  }

  filter {
    naam = "rajya"
    maan = ["uplabdh"]
  }
}

# EC2 udhaaharan ke liye ek suraksha samooh banaaen kisi bhi IP se SSH kii anumati dene ke liye or kisi bhi IP ke liye sabhi port ko Egress
sansaadhan "aws_security_group" "ec2_sg" {

  Ingress {
    vivaran = "kahin se bhi ssh"
    from_port = 22
    to_port = 22
    protocol = "tisipi"
    cidr_blocks = ["0.0.0.0/0"]
  }

  egress {
    vivaran = "kahin bhi ke liye"
    from_port = 0
    to_port = 0
    protocol = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

# ek EC2 udhaaharan banaaen
sansaadhan "aws_instance" "namoona" {
  ami = data.aws_ami.amazon_linux_2.image_id
  udhaaharan_tip = "t3.micro"
  suraksha_grups = [AWS_SECURITY_GROUP.EC2_SG.NAME]
}

`` `

is code main, ham pehle terraform or AWS pradaata sanskarnon ko paribhaashit karte hai, phir pradaata ko AWS hone ke liye nirdisht karte hai or sansadhano ko "US-EAST-1" (uttari varjeenia) kshetra main tainaat karte hai.

phir, ham ek suraksha samooh banaate hai jo sabhi inbound esaech or sabhi outbound trekkic kii anumati detaa he.

ant main, ham naveenatam amejan linaks 2 chhavi, "T3.Micro" udhaaharan prakaar ke saath ek EC2 udhaaharan ko paribhaashit karte hai, or suraksha samooh ko isamen sanlagn karte hai.

mujhe aashaa he ki vah madad karenge!</s>
