-
Notifications
You must be signed in to change notification settings - Fork 14
/
ec2.tf
37 lines (32 loc) · 867 Bytes
/
ec2.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
resource "aws_instance" "web" {
ami = "ami-026255a2746f88074"
instance_type = "t2.micro"
key_name = "skillupright"
subnet_id = aws_subnet.public[count.index].id
vpc_security_group_ids = [aws_security_group.allow_tls.id]
associate_public_ip_address = true
count = 2
tags = {
Name = "WebServer"
}
provisioner "file" {
source = "./skillupright.pem"
destination = "/home/ec2-user/skillupright.pem"
connection {
type = "ssh"
host = self.public_ip
user = "ec2-user"
private_key = "${file("./skillupright.pem")}"
}
}
}
resource "aws_instance" "db" {
ami = "ami-026255a2746f88074"
instance_type = "t2.micro"
key_name = "skillupright"
subnet_id = aws_subnet.private.id
vpc_security_group_ids = [aws_security_group.allow_tls_db.id]
tags = {
Name = "DB Server"
}
}