https://johnathan-sewell.github.io/AWS%20Local%20Zones
-
Installed express
pnpm i express
-
Added server/index.mjs (Start with
node .
) -
Added CDK stack for EC2 instance
SSH into the instance using the key pair. The key pair is created in the EC2 Dashboard.
The private key is downloaded stored on the local machine at ~/.ssh/Johnathan.pem.
The key is associated with the instance in CDK.
CPH
ssh -i "Johnathan.pem" [email protected]
EU
ssh -i "Johnathan-Eu.pem" [email protected]
Update and upgrade the system.
sudo apt update
sudo apt upgrade
Install Node
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
Rsync the code to the instance
CPH
rsync -avz --exclude 'node_modules' --exclude '.git' --exclude 'stack' --exclude '.env' \
-e "ssh -i ~/.ssh/Johnathan.pem" \
. [email protected]:~/app
EU
rsync -avz --exclude 'node_modules' --exclude '.git' --exclude 'stack' --exclude '.env' \
-e "ssh -i ~/.ssh/Johnathan.pem" \
. [email protected]:~/app
sudo npm install -g pnpm
Run the server
cd app
pnpm install --production
sudo node .
Browse to the client page: