title: AWS CodePipeline best practices with 2 AWS accounts
body: <p>Currently, my project uses 2 AWS accounts - one is for staging that our clients can rely on for testing and the other one is for production/live. I am trying to set up a CodePipeline for a new <strong>serverless</strong> application. I was wondering if this set up is proper and if there are ways to improve it.</p>
  
  <p><strong>Staging AWS account:</strong> GitHub Source -> AWS CodeBuild (test and build in staging env) -> Manual Approval Gate -> Deploy app in staging</p>
  
  <p>Then I'll verify the changes in staging before approving production deployment:</p>
  
  <p><strong>Production AWS account:</strong> GitHub Source -> AWS CodeBuild (test and build in prod env) -> Manual Approval Gate -> Deploy app in prod</p>
  
  <p>It seems like the test and build will be redundant but it seems easier to set it up like this since I can basically use the same Cloudformation template for the pipeline. Plus I don't have to worry with cross-account resource access.</p>
  
  <p>Whenever I push to master it'll basically trigger both of these pipelines. Is the redundancy a flaw that can be easily fixed? Is it simpler to just have the staging account have manual approval to promote to the prod account's pipeline and trigger it?</p>