Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying some files in .gitignore to AWS Elastic Beanstalk

Tags:

Knowing that eb deploy will deploy anything in your git repo, what is the best way to include files in that are included in .gitignore? I.e. config scripts with credentials etc.

Thanks in advance!

like image 673
pete Avatar asked Mar 21 '16 23:03

pete


People also ask

How to deploy incremental code updates to AWS Elastic Beanstalk using codecommit?

I want to use AWS CodeCommit to deploy incremental code updates to an AWS Elastic Beanstalk environment without re-uploading my entire project. You can use the Elastic Beanstalk Command Line Interface (EB CLI) to deploy your application directly from a CodeCommit repository. Install the EB CLI.

How do I deploy a source bundle to AWS Elastic Beanstalk?

You can use the AWS Elastic Beanstalk console to upload an updated source bundle and deploy it to your Elastic Beanstalk environment, or redeploy a previously uploaded version. Each deployment is identified by a deployment ID.

How do I deploy to Elastic Beanstalk?

Select an environment, and then choose Deploy . If you deploy often, consider using the Elastic Beanstalk Command Line Interface (EB CLI) to manage your environments. The EB CLI creates a repository alongside your source code.

How do I Configure my Amazon EC2 instance in Elastic Beanstalk?

Configure your Amazon EC2 instances in an Elastic Beanstalk environment by using Elastic Beanstalk configuration files (.ebextensions). Configuration changes made to your Elastic Beanstalk environment won't persist if you use the following configuration methods:


1 Answers

The answer is creating an .ebignore file. Here is how it works:

If you have my_keys.php in your .gitignore because you don't want to commit it because of sensitive info, create an .ebignore file and only add files that you don't want to be distributed to your instances.

If you don't add my_keys.php to your .ebignore, it will compile it and distribute while .gitignore will keep it out of your remote repo.

This behavior is explained in AWS docs:

If .ebignore isn't present, but .gitignore is, the EB CLI ignores files specified in .gitignore. If .ebignore is present, the EB CLI doesn't read .gitignore.

like image 65
pete Avatar answered Oct 16 '22 09:10

pete