Skip to content

Instantly share code, notes, and snippets.

@rdlh
Last active August 29, 2015 14:01
Show Gist options
  • Save rdlh/8c4ca50f8b356a2f63cf to your computer and use it in GitHub Desktop.
Save rdlh/8c4ca50f8b356a2f63cf to your computer and use it in GitHub Desktop.
Bootstrap Amazon Web Services EC2 with Node.js

Create your EC2

  • Launch Instance
  • Ubuntu Server (64b)
  • Micro Instance
  • Add storage
    • 30 Go max
  • Tag Instance
    • Name -> APP_NAME
    • Environement -> production
  • Configure Security Group
    • Add Rule
      • HTTP
  • Review and Launch

Connect to your EC2

sh -2 -i ~/.ssh/<MY_PEM>.pem ubuntu@<MY_PUBLIC_DNS>

Bootstrap the server

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties

If you are french (and proud!)

sudo apt-get install language-pack-fr
sudo locale-gen fr_FR.UTF-8

GitHub' configuration

git config --global color.ui true
git config --global user.name "<MY_NAME>"
git config --global user.email "<MY_EMAIL>"

Add SSH access to Github

ssh-keygen -t rsa -C "<MY_EMAIL>"
cat ~/.ssh/id_rsa.pub

Copy and past the cat result here :

https://github.com///settings/keys

Add SSH access to your computer

cat ~/.ssh/id_rsa.pub

Copy and past the cat result at the end ~/.ssh/authorized_keys on your EC2.

Change the ~/.ssh/config file and add those lines :

Host p.<MY_APP>
  HostName      <MY_PUBLIC_DNS>
  User          ubuntu

now use ssh p.<MY_APP> to connect your EC2 w/ SSH.

Let's ride the web

sudo apt-get install apache2

sudo a2enmod proxy
sudo a2enmod proxy_http
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment