Last active
October 15, 2019 17:20
-
-
Save amcginlay/6f02a509c2c9526793a25f4f49e382f7 to your computer and use it in GitHub Desktop.
nodejs server user data - example request: curl localhost/?workload=1000
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############# | |
# 1. Copy this script into EC2 User Data | |
# 2. Enable Cloudwatch detailed monitoring | |
# Usage: "curl localhost:80/?workload=1000" | |
############# | |
yum update -y | |
curl --silent --location https://rpm.nodesource.com/setup_10.x | bash - | |
yum -y install nodejs git | |
git clone https://github.com/amcginlay/nodejs-server.git /usr/local/bin/nodejs-server/ | |
# NOTE the server will not survive a reboot. | |
PORT=80 node /usr/local/bin/nodejs-server/app.js > /var/log/nodejs-server-out.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment