Since AWS Elastic Beanstalk does not provide different .ebextension scripts based on environment I'm using a little workaround to solve this.
- You need to declare an environment variable in your AWS EB application. (in my case SYMFONY_ENV)
- now you can read this variable in your deployment scripts
- You can not use the leader flag with the test command together. The test flag will overwrite the leader boolean.