Skip to content

Instantly share code, notes, and snippets.

@rogerwschmidt
Last active July 5, 2017 18:41
Show Gist options
  • Select an option

  • Save rogerwschmidt/16623357ed2899a6087c02c64d1f398c to your computer and use it in GitHub Desktop.

Select an option

Save rogerwschmidt/16623357ed2899a6087c02c64d1f398c to your computer and use it in GitHub Desktop.

Deploying to AWS

Objectives

  • Create EC2 instance
  • Get example application from github.
  • Use SCP to transfer files to a server
  • Install node un Ubuntu
  • Start node naively
  • Install git on AWS

How do you create a EC2 instance?

  • Log in/create account at Amazon AWS
  • Launch a new t2.micro Ubuntu Instance.
  • Add HTTP and HTTPS to security group
  • Create and download a new key
  • View instances
  • connect to the server using ssh ssh -i /path/to/pem/file [email protected]
  • update key permissions chmod 600 /path/to/pem/file
  • update apt-get repository sudo apt-get update
  • update system sudo apt-get updgrade

How do you get a repo from github?

  • Fork and clone https://github.com/rogerwschmidt/aws-deploy
  • npm install
  • npm start
  • Go to localhost:3000 in your browser to make sure that every thing works.

How do you use SCP to transfer files to a server?

  • Look at this documentation
  • In your aws instance
    • Create a folder for your server sudo mkdir -p /srv/express
    • Change premissions sudo chown ubuntu /srv/express
  • Copy files scp -i /path/to/pem/file -r . [email protected]:/srv/express

How do you install node in Ubuntu?

  • Resource
  • curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
  • sudo apt-get install -y nodejs
  • sudo apt-get install -y build-essential

How do you start node naively?

  • In /svr/express, run sudo PORT=80 npm start
  • In your browser, go to HTTP://your.ip.address.here
  • Run sudo npm install -g nodemon
  • In /svr/express, run sudo PORT=80 nodemon
  • Make a change on your local copy of the express app, and "redeploy" with scp

How do you intall git on AWS?

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