I am aware that CDK Pipelines is a thing, but my use-case is the exact opposite of what it’s made for: deployment to ECR → ECS.
So I tried dropping down to the aws_codepipeline constructs module, but haven’t had success with re-creating the same self-mutating functionality of the high-level CDK pipelines. I encountered a ton of permission errors and came to a point of hard-coding IAM policy strings for the bootstraped CDK roles, and at that point I figured I’m doing something wrong.
Anyone else had luck implementing this? I’m considering just creating a CDK Pipeline for CDK synthezation and a separate one for the actual image deployment, but I thought I’d ask here first. Thanks a bunch!
I’d probably just do two independent pipelines as their inputs are going to be very different. The CDK pipeline would trigger from git or S3 and create your ECR repo, image pipeline, and the trigger from one to the other.
In the lib folder, ignoring the SPA-specific deployment work. Basically, you run cdk bootstrap to bootstrap the account and then follow it up with cdk synth to make sure the stack synthesizes and then follow up with cdk deploy which will deploy the stack and in my linked example create a self-mutating pipeline.
Follow up question: in this setup, does the CDK synthezation always has to be the last step? I can imagine a lot of scenarios where new infrastructure is needed before the app deployments happen, and I can’t find a way to change the ordering of the stages – perhaps because the CDK Pipeline depends on the app deployment pipeline.
I never tried to change the order but my guess would be that it’s possible. It’s definitely been an issue once or twice but we never considered changing the order.