Sidharth Sidharth - 13 days ago 10
Git Question

Elastic Beanstalk .config file on VCS?

I'm using AWS Elastic Beanstalk to deploy a Laravel application and I've created a folder .ebextensions where all my .config files are stored.

The project is under VCS using GIT and I'm not sure if i want to add the .config to the repository as it contains some of my credentials.

Can the .config file be moved to s3 and used for deployment ?

Answer

In the Elastic beanstalk console

Configuration > Software Configuration > Environment Properties

You'll see a screen like this

enter image description here

You can fill in your environment variables here.

This means you don't need to set up environment variables in .config files, nor do you need to commit your .env file to VCS.

Environment variables entered into the console are copied to any EC2 boxes which elastic beanstalk manages for you within that application/environment.

The .env file in Laravel is designed to facilitate development and as such shouldn't be used in production. Anything in that file should be created as real environment variables and the .env file need not be present.

The .env file (via phpdotenv) simply creates environment variables at runtime, which isn't necessary if the environment variables actually exist already.