Exercise - Provisioning an Instance with a Simple Web Server
A previous exercise asked you to create a rule to open port 80 in the security group. Now you can use provisioning to install the Apache web server on your instance. You may choose to do this using either user_data or a remote-exec provisioner. With the Ubuntu image used in our examples, Apache can be installed with the command:
sudo apt-get install -y apache2
The server should start immediately after installation, but if you encounter problems you can force it to start/restart with:
sudo service apache2 restart
Once the server is running, you can test it by visiting the leader instance's IP address in a web browser
or by using it in a Linux shell command like curl IP_address
or wget IP_address
.