Introduction
This document is a weak memorandum for my cheap working job
connect AWS EC2 instnce
connect by SSH to Linux instance from ec2-user
- push [Connect (接続) ] buttom below

use EC2 Instance Connect (browser base SSH conection)
- select
EC2 Instance Connect
and push [Connect (接続) ] buttom below

install Node.js
install nvm (node version manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
activate nvm
. ~/.nvm/nvm.sh
install recent version of Node.js
nvm install node
test for correct Node.js install and execute
node -e "console.log('Running Node.js ' + process.version)"
then display below on terminal
Running Node.js VERSION
install Express web framework for Node.js
make service directory and change this directory
mkdir dev/nodejs/express/app
cd dev/nodejs/express/app
Node.js project initialization
npm init -y
install Node.js web framework Express
npm install --save express
then create node_modules
folder and setting lock file package-lock.json
install Express-Generator that create web application template library for express framework
install Express-Generator and create a template
npm install -g express-generator
create web application template that name is members
express --view=ejs members
move directory for web application template and install
cd members
npm install
test running express web application
npm start
then display terminal blow
> members@0.0.0 start /home/ec2-user/dev/nodejs/express/app/members
> node ./bin/www
open inbound port 3000 on AWS EC2 security group
- click security group link anchor

- then click [edit inbound rule (インバウンドルールの編集)] button
- add rule below
type(タイプ) | port area(ポート範囲) | source(ソース) |
---|---|---|
custom TCP | 3000 | 0.0.0.0/0 |

access web browser to URL
http://public DNS:3000/
- public DNS is about
- ec2-xx-xxx-xxx-xx.ap-northeast-1.compute.amazonaws.com
then display web browser blow
