5

I have a PHPproject hosted in Github and Im trying to setup a Continuous Integration using AWS Codepipeline and ElasticBeanstalk.

So far, Im able to get the repository contents from github and deploy it to ElasticBeanstalk. But I need to run a shell script before the deployment that will update a config.json file and also update a environment variable.

This is what Im trying to accomplish in the Pipeline:

  1. Get the project files from Github (done)
  2. Run a shell script that will update a config.json file in the project
  3. Run a shell script that will set a environment variable in ElasticBeanstalk
  4. Deploy to ElasticBeanstalk (done)

Any ideas of how I can get this working?

thanks

FelipeOliveira
  • 759
  • 8
  • 21

1 Answers1

1

CodePipeline doesn't support running shell in an action, but you may want to use CodeBuild, which can execute shell command to build or just update a file.

http://docs.aws.amazon.com/codebuild/latest/userguide/sample-elastic-beanstalk.html#sample-elastic-beanstalk-codepipeline

To set environment variables in ElasticBeanstalk, you can put a configuration file (.ebextensions/environmentvariables.config) in your source folder.

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environment-configuration-methods-after.html#configuration-options-after-console-ebextensions

zhngha
  • 246
  • 1
  • 3