Skip to content

Instantly share code, notes, and snippets.

@devops-school
Created April 3, 2023 04:22
Show Gist options
  • Save devops-school/d9e65c11c680a2caa91d7b5da3ce47c2 to your computer and use it in GitHub Desktop.
Save devops-school/d9e65c11c680a2caa91d7b5da3ce47c2 to your computer and use it in GitHub Desktop.
write a terraform code which would create Ec2 instance and use Existing Security Group and Key
region = "us-east-1"
}
resource "aws_instance" "example" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t2.micro"
key_name = "existing-key-name"
vpc_security_group_ids = ["existing-security-group-id"]
tags = {
Name = "Example Instance"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment