-
-
Save AnqiZhou26/1a5cb1290a28b9c5285bc46db363db6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create ec2 instances | |
resource "aws_instance" "web1" { | |
count = var.availability_zones_count | |
ami = "ami-0cff7528ff583bf9a" | |
instance_type = "t2.micro" | |
availability_zone = data.aws_availability_zones.available.names[count.index] | |
vpc_security_group_ids = [aws_security_group.public_sg.id] | |
subnet_id = aws_subnet.public[0].id | |
associate_public_ip_address = true | |
user_data = <<-EOF | |
#!/bin/bash | |
yum update -y | |
yum install httpd -y | |
systemctl start httpd | |
systemctl enable httpd | |
echo "<html><body><h1>Video Generator</h1></body></html>" > /var/www/html/index.html | |
EOF | |
tags = { | |
Name = "web1_instance" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment