You may use the following commands to configure an Amazon EC2 instance to install and start the Apache web server upon boot. The commands should be placed in the Advanced Details dialog box during during the provisioning process of an EC2 instance.
#!/bin/bash
sudo su –
yum install -y httpd
systemctl start httpd