1. First you needs to start your Ubuntu EC2 instance then write command sudo apt-get install apache2.
2. Ones you install apache2 restart it through sudo systemctl restart apache2.
3. For databases, we needs to install mysql server in your EC2 instance
by typing sudo apt-get install mysql-server then mysql_secure_installation.
4. During the installsation it will ask your password, you can provide any password or leave it blank.
5. If you wants to run PHP program on your instance then write command sudo apt-get install php.
When its complete then type sudo nano /etc/apache2/mods-enabled/dir.conf.
Here inside dir-config you needs to move index.php to the first position.
6. Ones we install php and mysql then restart the server with sudo systemctl restart apache2.
7. In order to check the status of apache2 you needs to write sudo systemctl status apache2
Simplest way to install web services in EC2 instances. If you have any query then feel free to mail me.