AWS Elastic Beanstalk

Keeping Elastic Beanstalk configs in code


I am a huge fan of Amazon Web Services, especially Elastic Beanstalk, and I love how easy it is to spin up and cast aside instances. When running Node services I use environment variables which conditionally load the specific configuration needed.

Now with several EC2 instances running, it can be tedious setting all those environment variables. To avoid this, and to keep all your custom configurations in your repo, I use the following;

I would not recommend you do this with security keys (S3/Facebook Tokens). I would definitely not do this if your source control is not suitably private and secure. So stop reading if you use public repositories as there are bots which scrape GitHub etc for such values.

In your project root

  • Create a folder called .ebextensions

  • In that folder create a file called environment.config

  • Add the following code to the file

option_settings: - option_name: NODE_ENV value: production

Once committed and deployed, the variables should appear in the ELB/EC2 configuration details.


javascript
aws

A tech native with 20 years of experience across the digital space. Darryl is an evangelist for the power and disruption of blockchain technologies and fosters a passion for bringing ever greater utility and adoption to the masses.

Related Articles

Babel

Fixing Uglify Errors With Babel

npm

Commercial Licenses for NPM Packages

Gatsby

Using Gatsby As A Blogging Tool

Copyright © 2016-2024 Bonbon Group Ltd. All Rights Reserved.