I currently have an AWS Codepipeline that is setup to automatically pull an Express, NodeJS API and deploy it with Lambda and API Gateway. It pulls the code from my GitHub repo production branch and deploys it. The project was created with Codestar, which creates a cloudformation stack and all the resources necessary to run the Express, NodeJS app.

The way the pipeline is setup by default deploys it to two endpoints. It deploys to Stage and to Prod. I want to have a setup that pulls from my production branch on GitHub and deploys to Prod and also pulls from my staging branch on GitHub and deploys to Stage. That way I can test my API with my staging applications/servers to see how it performs in that environment before finally merging with production.

What is the best way to go about this? Can I build this functionality in the 1 pipeline I currently have? Or should I be trying to duplicate the pipeline I have now and change the source to the other branch?

I'm also a little confused on how to get my API to only deploy to one resource endpoint. It currently deploys to both (Stage and Prod), even though it's coming from the production branch.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.