update user_data to enable nginx
This commit is contained in:
parent
5a4c16b8b2
commit
20fe5cb336
2 changed files with 8 additions and 0 deletions
|
@ -17,6 +17,7 @@ resource "aws_instance" "test_ami" {
|
||||||
user_data = <<-EOF
|
user_data = <<-EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
sudo dnf install -y nginx
|
sudo dnf install -y nginx
|
||||||
|
sudo systemctl enable nginx
|
||||||
sudo systemctl start nginx
|
sudo systemctl start nginx
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
@ -52,6 +53,12 @@ Embedded in there you'll see something liek this ```instance_public_ip``` thats
|
||||||
![Default nginx page](./img/webpage.png)
|
![Default nginx page](./img/webpage.png)
|
||||||
(I'm of course in dark mode, don't worry if yours is white with black text!)
|
(I'm of course in dark mode, don't worry if yours is white with black text!)
|
||||||
|
|
||||||
|
Right we now have our basic stack to work with. Everything else we do will be to update this stack, so **don't destroy** it just yet
|
||||||
|
|
||||||
|
#### Introducing variables
|
||||||
|
|
||||||
|
Right this is great and all but what if we want to make it easy to change things, such as the region we are deploying in or the size of the instance we are running. This is where variables make it easy, and as an added advantage we can create variable files for different environments with different values in them.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2. Validate
|
2. Validate
|
||||||
|
|
|
@ -49,6 +49,7 @@ resource "aws_instance" "test_ami" {
|
||||||
user_data = <<-EOF
|
user_data = <<-EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
sudo dnf install -y nginx
|
sudo dnf install -y nginx
|
||||||
|
sudo systemctl enable nginx
|
||||||
sudo systemctl start nginx
|
sudo systemctl start nginx
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue