continue lab 2 fix webserver user_data and switch to nginx

This commit is contained in:
Ric Harvey 2024-04-16 16:54:36 +01:00
parent 4e0325b7cc
commit 5a4c16b8b2
Signed by: ric
GPG key ID: 7FDEB4C0C7D5CB61
7 changed files with 14 additions and 3 deletions

BIN
.DS_Store vendored

Binary file not shown.

Binary file not shown.

BIN
2-simple-example/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -16,7 +16,8 @@ resource "aws_instance" "test_ami" {
user_data = <<-EOF user_data = <<-EOF
#!/bin/bash #!/bin/bash
sudo service apache2 start sudo dnf install -y nginx
sudo systemctl start nginx
EOF EOF
} }
``` ```
@ -42,7 +43,16 @@ tofu plan
tofu apply tofu apply
``` ```
Answer yes Answer yes at the apply prompt and you should end up with a screen like this:
![Tofu apply output](./img/lab-2-tofu-apply.png)
Embedded in there you'll see something liek this ```instance_public_ip``` thats out new output, copy the value and head to ```http://<YOUT_VALUE>/``` and you should get a very similar looking default nginx page.
![Default nginx page](./img/webpage.png)
(I'm of course in dark mode, don't worry if yours is white with black text!)
2. Validate 2. Validate

View file

@ -48,6 +48,7 @@ resource "aws_instance" "test_ami" {
user_data = <<-EOF user_data = <<-EOF
#!/bin/bash #!/bin/bash
sudo service apache2 start sudo dnf install -y nginx
sudo systemctl start nginx
EOF EOF
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB