Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload .env environment variables to elastic beanstalk

As far as I know the only way to set environment variables to elastic beanstalk is either:

  1. The AWS Online Console.
  2. The eb setenv command.

I have a .env file in my project that contains all of my environment variables over 100 variables and I'm looking for a way to push them all to the eb instance at the same time.

like image 534
ThomasReggi Avatar asked Sep 09 '16 15:09

ThomasReggi


1 Answers

First off, you should note that Elastic Beanstalk has a limit of fifty (50) environment variables per environment.

Now, if you've got a bunch of environment variables set in a .env file, an easy way to set them en-mass is to just dump them all into the eb setenv command like this...

eb setenv `cat .env | sed '/^#/ d' | sed '/^$/ d'`

This will set them all in one shot and save you spending all night on the aws console page. The sed command remove commented lines and new lines.

Explain Shell

like image 102
Matt Crampton Avatar answered Oct 08 '22 20:10

Matt Crampton