A basic (and deployable) structure for a NodeJS + Express application
ssh -i KEY.pem ec2-user@ec2-54-86-63-194.compute-1.amazonaws.com
In case you cannot connect to your AWS EC2 machine due permission problems, run the following command on the pem key:
sudo chmod 400 KEY.pem
First create a source bundle. This is a ZIP file that contains the app:
git archive -v -o app.zip --format=zip HEAD
Now transfer the source bundle your EC2 instance:
scp -i aws-base-proyect.pem app.zip ec2-user@ec2-54-86-63-194.compute-1.amazonaws.com:~
docker build -t node-web-app .
sudo docker run -p 8000:8000 -i -t node-web-app