File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
beginners/aws/modules/application_load_balancer Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ resource "aws_instance" "web1" {
2
+ ami = " enter-ami-id"
3
+ instance_type = " t2.micro"
4
+ subnet_id = " enter-subnet-id"
5
+ vpc_security_group_ids = [aws_security_group . allow_http_instances . id ]
6
+ key_name = " enter-key-name"
7
+ provisioner "remote-exec" {
8
+ inline = [
9
+ " sudo yum install httpd -y" ,
10
+ " sudo service httpd start" ,
11
+ " sudo chkconfig httpd on"
12
+ ]
13
+
14
+ connection {
15
+ type = " ssh"
16
+ user = " ec2-user"
17
+ host = aws_instance. web . public_ip
18
+ private_key = file (" ${ path . module } /key-name.pem" )
19
+ }
20
+
21
+ }
22
+ }
23
+
24
+ resource "aws_instance" "web2" {
25
+ ami = " enter-ami-id"
26
+ instance_type = " t2.micro"
27
+ subnet_id = " enter-your-subnet-id"
28
+ vpc_security_group_ids = [aws_security_group . allow_http_instances . id ]
29
+ key_name = " enter-key-name"
30
+ provisioner "remote-exec" {
31
+ inline = [
32
+ " sudo yum install https -y" ,
33
+ " sudo service httpd start" ,
34
+ " sudo chkconfig httpd on"
35
+ ]
36
+
37
+ connection {
38
+ type = " ssh"
39
+ user = " ec2-user"
40
+ host = aws_instance. web2 . public_ip
41
+ private_key = file (" ${ path . module } /kay-name.pem" )
42
+ }
43
+
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments