How to deploy your Node.js apps to AWS Elastic Beanstalk(without EB Cli)

AWS Elastic beanstalk

Create an Elastic Beanstalk Application and environment

  1. Click Services > Elastic Beanstalk > Create application
  2. Enter an Application name
  3. For the platform, Select Node.js and leave the other fields as the default.
  4. Click next and wait for the environment to be done setting up. This may take up to 2minutes.

Create a Code pipeline to automatically deploy changes

  1. Your node app should be setup and already running perfectly on localhost. My app holds a list of blogs and is an app I’m building following the fullstack course at fullstackopen.com. I’m using MongoDB Atlas for my database.
    Another thing to remember is that for your ports, you need to have them set up as
    const PORT = process.env.PORT || 3001
    This ensures that whatever port is being used by the server AWS gives us, is picked up by our App.
  2. In your AWS console, click on Services(see the menu) > Code pipeline. We will be hooking up our GitHub to AWS so that each time we push updates, our App is automatically deployed to AWS.
  3. Click Create Pipeline. Fill in the pipeline name. The role name gets filled out automatically. Then select new service role as your service role. Click next.
  4. Select GitHub as source provider. Click connect to GitHub to hook up your GitHub account to AWS. Select the repo your code is in and the branch. Skip the build stage and confirm.
  5. Enter your application name that you created in the Elastic Beanstalk console and select the environment name(automatically generated from your app name) from the list.
AWS Code pipelines deploy stage

BONUS: Setting environment variables

  1. Head to Environment > Select your application > Click Configuration
  2. Beside software, click edit.
  3. Scroll down to Environment properties.

--

--

--

Growth at Moni(YC W22) | Adebola.dev

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Kubernetes Architecture,Hands On!

Installation Guide of Anaconda on Windows 10 (64 bit)

API Testing with REST Assured-II

CSS — Definitive guide on how to horizontally center an absolutely positioned item with respect to…

Login/Registration Example with Spring Boot

Setup Hadoop HDFS-Cluster MAPREDUCE-Cluster and Client with HIVE by Ansible

Winning atVMworld, the Evolution of Network Engineering and the VPC

Now Offering Security Spot Checks

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adebola Adeniran

Adebola Adeniran

Growth at Moni(YC W22) | Adebola.dev

More from Medium

Workflow for setting up a web server in AWS EC2 (Free Tier).

Install MongoDB on EC2 Instance — Solved Connection Issue From Public DNS — ScanSkill

Using CloudFront to serve a Static Website hosted on an Amazon S3 Bucket

How to set up WordPress with a dedicated Database Server on AWS Cloud?