0

I am trying to figure out how can i set up two or more applications in single repository.

Lets say: I wanted to keep separate Eb Applications for Production(P) and Development(D) with one environment each(P > env-p & D > env-d). So how can i config my repository that master branch points to P > env-p and development branch points to D > env-d.

Note: I have setup Elastic Beanstalk in single AWS account with different applications. I have tried searching but could not anything related to this.

If any body have done this please share your views.

Thanks in advance.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Muzammil
  • 161
  • 1
  • 2
  • 12

2 Answers2

-1

If I understand you correctly you want to run an application with two different environments, for two different branches.

You can do that with a config file in: .elasticbeanstalk/config.yml

branch-defaults:
  master:
    environment: master
    default_region: ap-southeast-2
    default_ec2_keyname: master_key
    profile: master_profile
  staging:
    environment: staging
  develop:
    environment: develop    
global:
  application_name: my_application
  default_ec2_keyname: develop_key
  default_platform: Python 2.7
  default_region: ap-southeast-1
  profile: develop_profile
  sc: git

It will create this file when you do eb init for each branch, but I have seen it sometimes needs some manual edit.

Here is another answer for a similar question with more discussion.

AWS Elastic Beanstalk deploy to multiple applications

Related documentation:

Gustaf
  • 1,299
  • 8
  • 16
-2

I had a similar problem with filebeat configs in the same situation.

Basically, you need to use environment variables to differentiate the environment, and then run different commands in the container_commands section depending on which environment variables you have set.

You can see my worked example here: https://www.dativa.com/simplifying-filebeat-logging-with-elastic-beanstalk/

Tom
  • 172
  • 6
  • hey tom, thank you for your response, but my question was different than what you have suggested. I'm running two separate applications with one environment each. And you are talking about single environment with variables. – Muzammil Dec 06 '17 at 04:18