Procedure source: https://youtu.be/qor31Egu0Rg (applicable till 4:40 for Express.js)
- Spin up an EC2 instance on AWS
- Go to EC2 Dashboard and right click on your instance
- Select 'Security' -> 'Change Security Groups'
- See the 'Associated Security Group' entry, remember it.
- On the left app bar, select 'Network and Security' -> 'Security Groups'
- Right click on the remembered(step 4) group.
- Select 'Edit Inbound Rules'.
- Add two rules: HTTP and HTTPS, set source for both to be 'IPv4 Anywhere'. Done.
- Choose
Route 53
from list of AWS services. - Go to 'DNS Management' -> click 'Create Hosted Zone'
- Enter your domain and select 'Public Hosted Zone', enter 'OK'*.
- 2 Records are created. Create new 'Record', of type 'A IPv4', and add the EC2 instance's Public IPv4 as value. Click 'ok'.
- Create another record of type 'CNAME', add 'www' in prepend box and 'safaq.me' as 'value'. Done.
- Go to your domain registrar.
- Go to DNS edit options.
- Add 4 domain like strings from step 4's Record (type: NA) (created automatically), without the ending period as the 4 name servers. Done.
- 'Connect' to your
EC2
instance. - Run the command
screen
, reason. - Start the server on PORT 80. e.g. I was using Express.js, this needs root priveleges for PORT 80. Go root by running
sudo su
, thenPORT=80 node path_to_server/server.js
.
You're live 🚀!