AWS is the most popular cloud provider. As per our latest report,  State of Frontend 2020, it has more users than Azure and Google Cloud Platform combined! Even though it is so popular, AWS is difficult to use for many users, especially when it comes to deployment. That’s why I decided to show you how to deploy Node.js app to AWS using Elastic Beanstalk.

Most of us know basic AWS services like S3 or EC2, but when it comes down to making our app public, the only idea we’ve got is to create EC2, SSH on it, and set up some poor man’s CD with Github Hooks. We’d rather use Heroku (because it is easier), than AWS (because we don’t know how easy it is to deploy something with it). This time we will go through 99% automated deployment of any (however, we will use Node.js as an example) dockerized app on AWS.

What is Elastic Beanstalk?

Let’s assume we have a fully-functional dockerized app. We don’t have any environment set yet, but we would like to set up staging and production easily with the least possible complexity.

The thing is that most of the time, when we read Docker, we actually think about a lot of tools like Kubernetes, or Terraform which are difficult to understand. We might even think that we need a DevOps to actually deploy such an app. Yet all of those points are false.

AWS offers us a few ways to deploy Docker containers:

  • doing it manually using EC2 with Docker installed on it,
  • using ECS (Elastic Container Service) to deploy containers,
  • using Elastic Beanstalk to orchestrate the whole infrastructure for us.

The first one is the worst choice. We will need to handle everything by ourselves – from creating an instance, through infrastructure setup and configuration, to installing and maintaining software on EC2 (for example installing Docker).

The second option is the most configurable, yet it is also the most complex one. It will require some additional experience, so you can set up everything appropriately. Nevertheless – it gives you the highest scalability.

The third one is the easiest, yet often forgotten. The way Elastic Beanstalk works is that you need to upload your code (or even connect it to your repository) and the rest is done by EB. It will set up a basic infrastructure, deploy your code on it, and even connect monitoring for you. All of this at the click of a button.

#amazon #aws #docker #node.js #beanstalk

How to Deploy Node.js app to AWS using Beanstalk
13.70 GEEK