On AWS its preferred to have ubuntu server and install Nginx for Magento 2 websites

Below are commands to run to install Nginx and mysql

sudo apt update
sudo apt install nginx

sudo apt install mysql-server
sudo mysql_secure_installation

After installing Mysql change default password  of root user and create new user

sudo mysql

SELECT user,authentication_string,plugin,host FROM mysql.user; 

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR PASSWORD HERE'; 


SELECT user,authentication_string,plugin,host FROM mysql.user;

Now install PHP 7.2 for Magento 2.3 and PHP7.4 for Magento 2.4

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install awscli php7.2-fpm php7.2-mysql php7.2-bcmath  php7.2-curl php7.2-gd php7.2-common php7.2-intl php7.2-mbstring php7.2-soap php7.2-xsl php7.2-zip php7.2-xml

The next Step creates an apache user which will allow the server for the automatic file generation process and to above file permissing issues.

sudo adduser apacheuser
sudo passwd apacheuser
sudo usermod -g www-data apacheuser
sudo usermod -aG sudo,adm,root,ubuntu apacheuser
sudo chsh apacheuser -s /bin/bash

Enabled New Apache user to access files through FTP or SFTP

sudo nano /etc/ssh/sshd_config
comment line 
PasswordAuthentication no
sudo /etc/init.d/ssh restart

Next step would be point domain to server IP and arrange virtual host setup

sudo chown -R apacheuser:www-data /var/www/
sudo chown -R apacheuser:www-data /etc/nginx/sites-available/
sudo nano /etc/nginx/sites-available/sitename
sudo ln -s /etc/nginx/sites-available/sitename /etc/nginx/sites-enabled/
sudo service nginx restart

Configure your virtual host file and upload Magento files to the folder

That’s it.