Skip to content

Instantly share code, notes, and snippets.

@cjlyth
Last active November 2, 2019 07:14
Show Gist options
  • Save cjlyth/fd0d6b986b96e0ee5b64ebaea9387a03 to your computer and use it in GitHub Desktop.
Save cjlyth/fd0d6b986b96e0ee5b64ebaea9387a03 to your computer and use it in GitHub Desktop.
dev-instance-userdata.sh
#!/usr/bin/env bash
yum update -y
yum groupinstall "Development Tools" -y
sudo -u ec2-user git config --global credential.helper '!aws codecommit credential-helper $@'
sudo -u ec2-user git config --global credential.UseHttpPath true
# Borrowed from https://forums.aws.amazon.com/thread.jspa?messageID=911050
echo "Setting up NodeJS Environment"
curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
echo 'export NVM_DIR="/home/ec2-user/.nvm"' >> /home/ec2-user/.bashrc
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> /home/ec2-user/.bashrc
# Dot source the files to ensure that variables are available within the current shell
. /home/ec2-user/.nvm/nvm.sh
. /home/ec2-user/.bashrc
# Install NVM, NPM, Node.JS & Grunt
nvm alias default v12.13.0
nvm install v12.13.0
nvm use v12.13.0
curl -o- -L https://yarnpkg.com/install.sh | bash
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment