Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should I ignore .elastbeanstalk folder?

I have an Elastic Beanstalk Python Application.

So I already made my build script where I do generate a deploy.zip file that I do deploy into EB. It does work just as it suppose to.

So after building my script for building an artifact (my deploy.zip) that is compatible with EB, I began to work on configuring EB cli for using eb deploy in my gitlab-ci, so it will deploy to EB homologation server when there be a commit on development branch and into EB production when get into master. ( right now I'm just working on homologation server).

So I did read the documentation and notice that eb would build the artifactory by itself. But as I already had my own build script, this Deploying an Artifact Instead of the Project Folder so I made a .elasticbeanstalk folder and a config.yml in it with the follow configuration.

deploy:
     artifact: deploy.zip

So I did a eb init, did set everything (region, id, key and selected my existing project.

When I did eb deploy it worked just as it suppose to. So I did suspect that eb was making de artifactory by itself, so I checked the config file and notice that eb had add a bunch of other config into the file, my deploy config was there, so for another test I did deleted my deploy.zip so when I did a eb deploy it failed just as it suppose to.

Until this point everything was running just as I was planning to, so I did a git status for checking before adding the .elasticbeanstalk folder into git. For my surprise the folder was not been listed and the .gitignore file was changed. When checking the .gitignore it had the .elasticbeanstalk in it.

So it got me alert about if I should add this folder into the git, as de default behavior of eb is to add it into ignore.

I was planning to commit the eb configurations and set the keys using environment variables as is says in Configuration Settings and Precedence session.

I've tried to run eb deploy without the configurations just passing env vars before the command, something like AWSAccessKeyId=<access_key> AWSSecretKey=<secret_key> eb deploy, but it says that I should run eb init before it.

So shouldn't I git my eb configuration? If not how should I procede for a CI deploy with EB ?

like image 346
wviana Avatar asked Dec 21 '17 20:12

wviana


1 Answers

.elasticbeanstalk is a place where eb cli stores it's configuration. As you wrote - one file config.yml is there, so you can create it by yourself. When you call eb init your version is overwritten, by the command.

If you have only one environment, or security is not an issue - then having that configuration in your repository is good idea. You are exposing some details like ssh key name, so for security reasons not all should see it. By all I men public repo. Perhaps that is why they put it to .gitignore.

Note that usually you have test, pre-prod, prod, environments - so configuration is needed anyway. Next step is a separate configuration repository for all that devopsish stuff, and there you can have directory, or branch per environment.

I agree with you that it looks strange - .ebextensions are not secured that way...

If I miss something - post question, I'll append clarification to this answer.

like image 140
Michał Zaborowski Avatar answered Oct 18 '22 15:10

Michał Zaborowski