- Log in to AWS Management Console:
- Navigate to the EC2 Dashboard.
- Launch a New Instance:
- Click on "Launch Instance".
- Choose an Amazon Machine Image (AMI). Select the Ubuntu Server AMI (Ubuntu 20.04 LTS recommended).
- Choose an Instance Type (e.g., t2.micro for free tier eligibility).
- Configure Instance:
- Select an existing key pair or create a new one. Download the key pair (.pem file).
- Configure Security Group:
- Create a new security group.
- Add a rule to allow SSH (port 22) and HTTP (port 80) from anywhere (0.0.0.0/0).
- Review your settings and click "Launch".
- Open a Terminal/PowerShell:
- Navigate to the directory containing your
.pem
file. - Connect to the Instance:
- Update the Package Lists:
- Install Apache:
- Check Apache Status:
- Apache should be active (running).
- Upload Your Website Files:
- open another Terminal; copy your website files to the server.
- Move Files to the Web Root:
- return to the terminal already connected to your Ec2 server and move the files to the Apache web root
- Verify Deployment:
- Open your web browser and paste your instance's public IP address (e.g., http://54.208.104.210/ ).
ssh -i "path/to/your-key.pem" ubuntu@your-ec2-instance-public-ip
sudo apt update
sudo apt install apache2 -y
sudo systemctl status apache2
scp -i "path/to/your-key.pem" -r path/to/your-website/* ubuntu@your-ec2-instance-public-ip:/tmp/
sudo mv /tmp/* /var/www/html/