Skip to content

Instantly share code, notes, and snippets.

@moshest
Last active January 17, 2018 17:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save moshest/32b19e146bc5e1665708c885e535a631 to your computer and use it in GitHub Desktop.
Save moshest/32b19e146bc5e1665708c885e535a631 to your computer and use it in GitHub Desktop.
AWS CodeDeploy with Node.js
#!/bin/bash
# usage: `curl --silent --location https://gist.githubusercontent.com/moshest/32b19e146bc5e1665708c885e535a631/raw/install.sh | bash -`
set -e
yum -y update
AWS_REGION=`curl http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}'`
echo AWS Region: $AWS_REGION
# install CodeDeploy
cd /home/ec2-user
yum install -y ruby aws-cli
aws s3 cp s3://aws-codedeploy-$AWS_REGION/latest/install . --region $AWS_REGION
chmod +x ./install
./install auto
rm -f install
# install node
curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
yum -y install make gcc gcc-c++ nodejs default-jre ImageMagick
# install latest stable node version with "n"
npm install -g n
n stable
# install pm2
npm install -g pm2
pm2 update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment