Create EC2 using Terraform
Jan 4, 2023
Create single instance EC2 using Terraform
To create an EC2 instance using Terraform, you will need to specify the Amazon Machine Image (AMI) that you want to use, the instance type, and any other configuration options that you want to set. Here is an example of how you could create an EC2 instance using Terraform:
resource "aws_instance" "ec2-everton" {
ami = "ami-0ff8a91507f77f867"
instance_type = "t3.micro"
key_name = "evertonkey"
security_groups = ["sg-0ff69345569666666b"]
tags = {
Name = "Ec2-everton"
}
}
This will create a new EC instance using the specified AMI and instance type, and assign it the specified key pair and security group.