LzDeployPipeline Script

The LzDeployPipeline.ps1 PowerShell script is run on the Management Workstation to deploy a specific CodeBuild project. This is required after you make changes to a CodeBuild project template file.

CodeBuild project template files

The Tutorial system used three CodeBuild project template files located in the LazyStackSMF folder:

  • Test_CodeBuild_PR_Create.yaml
  • Test_CodeBuild_PR_Merge.yaml
  • Prod_CodeBuild_PR_Merge.yaml

It is common practice to copy and rename these files into your LazyStackSettings folder and then edit the BuildSpec section of the template to implement specific build, test and deploy functionality for your stacks.

Security Best Practice

Each CodeBuild Project Template file contains a IAM policy providing the least privileges typically required to deploy an AWS Serverless Stack. Review that policy and if your Serverless Stacks require more or less privileges you should modify the template to suite your requirements.

Running the LzDeployPipeline Script
  1. Open a PowerShell terminal

  2. CD into your LazyStackSettings folder.

  3. ..\LazyStackSMF\LzDeployPipeline.ps1
Deploy all Pipelines

Run the LzConfigure script to deploy all pipelines. Each pipeline project is defined in a AWS Cloud Formation template. LzConfigure uses CLI SAM to deploy these templates. Cloud Formation checks if the template being deployed is different from the one currently deployed and skips the deployment if the Pipeline project is already deployed.

CodeBuild instead of CodePipeline

We are using AWS CodeBuild to implement CI/CD. AWS also offers AWS CodePipeline. AWS CodePipeline offer additional features that are unnecessary for this SMF design. They can be implemented if desired and a CodePipeline project can, in large part, reuse the CodeBuild projects defined in this SMF design. For most Serverless Stack applications, the simpler CodeBuild projects are all that is needed.