Deploy ec2 instance to VPC with terraform

provider "aws" {
  access_key = ""
  secret_key = ""
  region = "ap-southeast-1"
}

resource "aws_instance" "web-1" {
  vpc_security_group_ids = ["sg-xxxxxxxx"]
  subnet_id = "subnet-xxxxxxxx"
  ami = "ami-xxxxxxxx"
  availability_zone = "ap-southeast-1a"
  instance_type = "t2.micro"
  tags {
    Name = "test-terraform-1"
  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *