Using AWS Elastic Beanstalk and Namecheap to deploy and host your Node.js app

ryanwaits
2 min readMar 10, 2016

--

It took me a few hours to piece together a lot of the information out there needed to get my Node.js app both deployed and hosted, so I’ll try to make this walkthrough a one stop shop.

Installation

Install Python and pip

We’ll be using the Elastic Beanstalk command line interface so we need to make sure Python and pip are installed. There are a few ways to do this, but using brew was the easiest and fastest for me.

  • brew install python
  • Check if installation was successful with `pip — version` (if you get a bad interpretor error, use `brew link — overwrite python` to use the version of python installed with brew

Install Elastic Beanstalk CLI

Use pip to install the awsebcli

  • pip install awsebcli
  • Check for upgrades: `pip install — upgrade awsebcli`
  • Use `eb — version` to verify installation

Configuration

Retrieve AWS Access ID & AWS Secret Key

  • Go here and select “Continue to Security Credentials”. You can download your access ID and secret key

Initialize Elastic Beanstalk inside your app

  • Inside your directory, run `eb init`

The prompts are as follows:

  1. Select default setting (should be option 3, US West Oregon)
  2. Set your access ID and secret key
  3. For a new application, default is 2
  4. Enter the name of your application
  5. Select your platform from the list
  6. Unless you know better, select ’n’ for SSH option

Configure the Environment

You can select the default for the next set of prompts to get your environment up and running after running `eb create`

  • Run `eb create` inside your directory
  • Check the status with `eb status`
  • Once the environment is set up, you can use `eb open` to open the app in a browser
  • When you make any changes, use `eb deploy [nameofyourapp]`

Domain Name & AWS 53 Management

AWS Route 53Management

  • Go here and under the Networking section, select Route 53
  • Create a hosted zone for your domain
  • In the domain name field, enter “yourdomainname.com” and make sure it is set to public.
  • Inside of your hosted zone, create a new record
  • In the name field, enter “www.yourdomainname.com” and make sure to set the type to A-IPv4 address, set the alias to yes, and then save the record

Set up domain with Namecheap

  • Log in to your Namecheap account
  • Select the Manage option at the right of the domain you want to set up
  • Select the Advanced DNS tab
  • For the CNAME record, change the host column to @ from www. For the value, paste in your Elastic Beanstalk environment address. You can find your address inside your Elastic Beanstalk console on AWS
  • For the url redirect set the host to www and set your domain url to “http://yourdomainname.com”

You should now have a deployed Node.js app on AWS.

--

--