February 2020
Intermediate to advanced
440 pages
13h 51m
English
In this recipe, we updated our instance and set up a simple Apache web server using EC2 user data. We used Amazon Linux 2 as our base AMI, so we used commands that are specific to Amazon Linux 2. If you are using Amazon Linux 1, you can use the following set of commands instead:
#!/bin/bashyum update –yyum install -y httpdservice httpd startchkconfig httpd on
For the instance that hosts the web server, we allowed HTTP through our security group. We also added a rule to allow SSH from our local IP for configuring and troubleshooting. In most real-world projects, this would be done through another dedicated machine, known as a bastion host or a jump host.
Read now
Unlock full access