This was based on a blog post that can be found here. Parallel deploys can speed up your times if you have several stacks to deploy at once with (or without) dependencies on each other. The magic number seems to be around 6+ stacks to see some real wins. There are some cases where parallel is slower for small changes due to action runner setup.
Disclaimer Faster does not necessarily mean cheaper. This method utilizes more concurrent running time and costs a bit more.
You can see in the image that the parallel finishes while the serial is still running. The serial version was still deploying to demo when the parallel finished.
- Serial: The initial serial deploy took
22m14s
to get from build -> demo -> prod - Parallel: The initial parallel deploy took
12m29s
to get from build -> demo -> prod
With some smaller changes we don't make as huge gains with a lower number of stacks. However, in a larger application we see some better wins.
- Serial: The initial serial deploy took
8m56s
to get from build -> demo -> prod - Parallel: The initial parallel deploy took
8m0s
to get from build -> demo -> prod
https://github.com/aws-actions/configure-aws-credentials#sample-iam-role-cloudformation-template
- stackDeps.js - parses the
cdk.out/manifest.json
and returns our stacks - generateStackGraphs.js - uses
stackDeps.js
andcdk synth
to generate thegraph.json
- graph.json - the generated graph from our
npx projen generate:stack-graphs
task - graphDeploy.js - custom projen deploy workflow that generates the
deploy.yml
for the project. We take the graph fromgenerated/graph.json
and create a workflow based on the dependencies.
# Generate the stack graphs first
npx projen generate:stack-graphs # custom task in .projenrc.js
# Then run projen default to create the workflow
npx projen