Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy only specified files to AWS Elastic Beanstalk

AWS Elastic Beanstalk allows for you to upload a git repository to your environment with a simple eb deploy command.

I know anything placed inside the .gitignore won't be deployed, but what about source files (sass, uncompressed scripts) I want to keep in the repository, but don't want uploaded on deployment.

Is there a way to only upload specific files?


Follow-up

Using Tal's answer below I was able to remove files on deploy with the following:

container_commands:
  remove_src_folder:
    command: "rm -rf public/src/"

Given this folder structure:

— .elasticbeanstalk
— .git
— public/
    — dist/
    — src/
    — index.php
like image 741
Rich Avatar asked Feb 05 '15 19:02

Rich


People also ask

What is difference between immutable and blue green deployment?

The main difference is that in the immutable update, the new instances serve traffic alongside the old ones, while in the blue/green this doesn't happen (you have an instant complete switch from old to new).

What format can source files be in for Amazon Elastic Beanstalk?

Your source bundle must meet the following requirements: Consist of a single ZIP file or WAR file (you can include multiple WAR files inside your ZIP file) Not exceed 512 MB. Not include a parent folder or top-level directory (subdirectories are fine)

When should you not use Elastic Beanstalk?

Elastic Beanstalk isn't great if you need a lot of environment variables. The simple reason is that Elastic Beanstalk has a hard limit of 4KB to store all key-value pairs. The environment had accumulated 74 environment variables — a few of them had exceedingly verbose names.

How do you deploy codes in Elastic Beanstalk?

Open the Elastic Beanstalk console , and in the Regions list, select your AWS Region. In the navigation pane, choose Environments, and then choose the name of your environment from the list. If you have many environments, use the search bar to filter the environment list. Choose Upload and deploy.


1 Answers

You can ignore files, which are in git using .ebignore. It will cause .gitignore to be ignored, so you may need some duplicate rules in both files.

It is documented here:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-configuration.html#eb-cli3-ebignore

like image 147
ThomasRedstone Avatar answered Oct 04 '22 22:10

ThomasRedstone