AWS
🌐 AWS Server Setup & Website Deployment
1. AWS Login 🚪
Account Types
Root User: Main account holder, manages everything (email & password).
IAM User: Limited permissions for security (can only perform specific tasks).
2. Log in to AWS Console 💻
Log in to AWS Management Console.
Region Selection: Set to London (or choose your preferred region).
3. Launch an EC2 Instance 🚀
Steps:
Navigate to EC2 Service:
Console > EC2 > Instances > Launch Instance.
Instance Name and Tags:
Provide a name for the server, e.g., "Frontend Server", "Backend Server".
Application and OS Images (Choose the OS for your server):
Options:
Ubuntu (Recommended) 🐧.
Amazon Linux.
macOS.
Example:
Select Ubuntu Server 22.04 LTS (HVM), SSD Volume Type.
4. Instance Details ⚙️
AWS Architecture Overview:
The architecture comprises:
Virtual Private Cloud (VPC) to isolate resources.
EC2 Instances to host the server.
S3 for object storage.
Security Groups for managing inbound/outbound traffic.
Select 64-bit (x86) for compatibility.
Instance Type
t2.micro: Suitable for small web apps, Free Tier (React Apps).
t2.small: Suitable for backend services (Paid).
Key Pair (Login) 🔑
Click on Create new key pair.
Provide a name for the project.
Select File Type: .pem and Download.
Save it securely to access the server later.
Network Settings 🌐
Allow SSH Traffic from anywhere (tick).
Allow HTTPS and HTTP Traffic from the internet (tick).
Configure Storage 💾
Allocate 30 GB (default, gp2 SSD).
Advanced Details (Optional) ⚙️
No changes required here.
Summary 📝
Review all settings:
Number of instances: 1 or more based on requirements.
AMI: Ubuntu 22.04 LTS.
Instance Type: t2.micro or t2.small.
5. Create and Connect to EC2 Instance 🔌
Create the EC2 Instance 🖥️
Click Launch.
Connect to the Instance 📡
Create IAM Role: Attach
AmazonSSMFullAccess
for secure access.Enable Fleet Manager host.
Connect Using SSH 🔐
6. Install Dependencies for Web Application ⚙️
Become Super User
Install Node.js & NPM 🌐
Follow the guide here.
Use the first option command.
After installing Node.js:
If you encounter errors, refer to the Node.js Package Manager Guide.
Install MongoDB 💾
Follow this tutorial.
If there are issues:
Download
libssl1.1
:
Install Nginx 🌐
Follow this tutorial.
Use
"Nginx Full"
for firewall settings:
Install PM2 🔄
7. Upload Application Code 📁
Upload Frontend & Backend Code
Install NVM (Node Version Manager) 🌐
Site Configuration for Nginx ⚙️
Unlink Default Config File
Create New Config File for Frontend & Backend 🖊️
Frontend Configuration Example:
Backend Configuration Example:
Enable Configuration
Test and Restart Nginx ⚙️
8. Set Up SSL 🔒
Install Certbot:
Generate SSL Certificate:
Renew Certificate:
9. Additional Configurations 🛠️
Start Services
Check Service Status
Add IAM Role for SSM 📊
Assign SSM Administrator access to connect easily via AWS Systems Manager.
10. DNS Setup 🌍
A Records and CNAME
Main Website: Use A Record pointing to instance IP.
Subdomain (same instance IP): Use CNAME Record.
Different IP: Use A Record.
11. Extra Commands & Tips 💡
List PM2 processes:
Check Certbot Certificates:
If stopping and restarting the instance, update DNS with the new IP address.
Conclusion 🎉
AWS provides powerful and flexible tools to build scalable and secure infrastructure for your website. With these steps, you're on your way to mastering AWS deployments!
Last updated
Was this helpful?