The Ultimate Guide for Quickly Launching Websites Using AWS & Namecheap

Abstract vector created by vectorjuice — www.freepik.com

Static Web Page

Complex Websites

1. Build your application

npm i -g create-react-native-app
create-react-native-app {{project name}}

2. Dockerization (Optional)

FROM node:12.18

# Install requirements
RUN npm install -g expo-cli

# Install dependencies
ADD package.json .
CMD [“npm”,”install”]

# Copy contents
COPY . /

# Run application
CMD [“sudo”,”expo”,”start”,” — web”]
docker build — network=host -t test:v0 .
docker run -i -t -d -p 3000:3000test:v0
http://localhost:3000

3. Set Up the Server

ec2–11–222–333–444.ap-east-1.compute.amazonaws.com
Hostname: ubuntu@ec2-11–222–333–444.ap-east-1.compute.amazonaws.com
Port: 22
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install nodejs -y
node -v
npm -v
$ node -v
v12.21.0
$ npm -v
6.14.11
sudo npm i -g serve
git clone YourGitRepoUrl
cd YourGitRepoName
npm install
npm run build
serve -s build
Type:       Custom
Protocol: TCP
Port range: 5000
Source: YOUR_IP

4. Get Your Domain Name

www.namecheap.com
www.name.com
www.godaddy.com
orAWS Route 53
Record Name: www.YOUR.DOMAIN
Type: A
Value: EC2_IP_ADDRESS
Record Name: YOUR.DOMAIN
Type: A
Value: www.YOUR.DOMAIN.
NS record example
Type:       HTTP
Protocol: TCP
Port range: 80
Source: 0.0.0.0/0
Type: HTTP
Protocol: TCP
Port range: 80
Source: ::/0
sudo iptables -t nat -I PREROUTING -p tcp — dport 80 -j REDIRECT — to-port 5000
sudo iptables -I INPUT -p tcp — dport 5000-j ACCEPT

5. Set SSL Certificate (Get HTTPS on your website)

Record Name: www.YOUR.DOMAIN
Type: A
Value: EC2_IP_ADDRESS
Type:       HTTPS
Protocol: TCP
Port range: 443
Source: 0.0.0.0/0
Type: HTTPS
Protocol: TCP
Port range: 443
Source: ::/0
sudo iptables -t nat -I PREROUTING -p tcp — dport 443 -j REDIRECT — to-port 5000
sudo iptables -I INPUT -p tcp — dport 5000 -j ACCEPT

6. Transfer Region (Optional)

sudo iptables -t nat -I PREROUTING -p tcp — dport 80 -j REDIRECT — to-port 5000
sudo iptables -I INPUT -p tcp — dport 5000 -j ACCEPT
sudo iptables -t nat -I PREROUTING -p tcp — dport 443 -j REDIRECT — to-port 5000
sudo iptables -I INPUT -p tcp — dport 5000 -j ACCEPT

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store