March 26, 2019
This will talk through the installation and possible pitfalls when deploying node.js applications on AWS Elastic Beanstalk service. While the documentation found on the AWS site is good it skips over some basics to get an application running. The application example is express app, that renders the current Billboard Top 100. Find the code here at Github.
The AWS CLI will let you configure your security credentials to allow access to your AWS account. The EB CLI is a far better tool for deployment on AWS Elastic Beanstalk itself, otherwise you are left uploading
zip files with your source code. Since the installation of both these packages is covered well on AWS Docs it is best to simply follow those.
The follow are the commands you will need to deploy your node application to AWS Elastic Beanstalk. I assume that you have successfully configured your AWS CLI by running
aws configure. Note: AWS Elastic Beanstalk will always deploy your latest git commit.
git init and
git add . and
git commit -m "hello aws eb" your files.
"start": "node app" in
8081 to connect so be sure to define your ports as
const port = process.env.PORT || 8081; in your application.
eb init to create your application.
.elasticbeanstalk directory with a
config.yml add it to your
eb create to create an environment for your app.
Use CodeCommit since this is AWS Private Git repos. This step takes ~5 minutes.
eb console which will take you directly to Elastic Beanstalk console page.
.npmrc file and add
unsafe-perm=true this is especially common for any dependecy that needs to compile from source and runs