Can a single CodeCommit repo deploy to multiple environments?

1.7k views Asked by At

I have a simple web application which uses AWS CodeCommit, CodePipeline and CodeDeploy. When ever a change is done and pushed to git, CodePipeline kicks in and deploys the code to the QA environment - WINDOWS. Now I want to setup a MANUALLY triggered deployment from the same repository to the production environment. However the source code locations are not the same. Also I may want to use different AfterInstall bat file. how can I have different appspec.yml or afterinstall.bat files in this situation. Or is there any other way of doing it?

1

There are 1 answers

3
TimB On BEST ANSWER

Here's an approach that should work:

  1. Have two files in your repository appspec_qa.yml and appspec_prod.yml each with the configuration you need for that stage.
  2. Have two CodeBuild steps which each produce a separate artifact with the respective appspec_*.yml renamed to just appspec.yml
  3. Have two CodeDeploy applications, one for qa and one for prod.
  4. Have a pipeline which deploys the qa artifact to the qa CodeDeploy application, and the prod artifact to the prod CodeDeploy application.
  5. Have a manual approval between the qa and prod stages