Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cdk-pipelines] Add an example of Lambda with blue/green or canary deployments #9276

Closed
srethira opened this issue Jul 27, 2020 · 9 comments
Closed
Labels
@aws-cdk/pipelines CDK Pipelines library closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. documentation This is a problem with documentation. effort/large Large work item – several weeks of effort feature-request A feature should be added or improved. p2

Comments

@srethira
Copy link

Please provide documentation for implementing blue/green or canary deployments using CDK Pipelines.


This is a 📕 documentation issue

@srethira srethira added documentation This is a problem with documentation. feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jul 27, 2020
@SomayaB SomayaB changed the title [cdk-pipeline] Add an example of Lambda with blue/green or canary deployments [cdk-pipelines] Add an example of Lambda with blue/green or canary deployments Jul 27, 2020
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Jul 27, 2020
@ericzbeard ericzbeard added p2 and removed needs-triage This issue or PR still needs to be triaged. labels Jul 27, 2020
@ericzbeard ericzbeard removed their assignment Jul 28, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 4, 2020

We don't think Lambda B/G deployments are safe in the general case.

The B/G part of the deployment only works if you change the Lambda source code, not if you change anything about related objects. The easiest to get wrong is the IAM policy. If you change code and remove a permission (which is a simple thing to do in CDK) the policy changes will be deployed in a point-in-time fashion, breaking your old Lambda version that would still be requiring it.

This is a sharp edge that we are afraid a lot of people will get bitten by. As such, you can do this today, but I'm not sure we're ready to recommend it for general use yet.

@rix0rrr rix0rrr added the effort/large Large work item – several weeks of effort label Aug 4, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 4, 2020

By the way we do have an example of Lambda B/G deployments here: https://docs.aws.amazon.com/cdk/latest/guide/codepipeline_example.html

@BrianFarnhill
Copy link

I was building this for a demo recently actually - code is in one of my repos (purely for demo purposes) - https://github.com/brianfarnhill/Examples.LambdaDeploymentPipeline - have a look at it, it might be useful

@rix0rrr rix0rrr removed their assignment Jun 3, 2021
@AdamTylerLynch
Copy link

I was building this for a demo recently actually - code is in one of my repos (purely for demo purposes) - https://github.com/brianfarnhill/Examples.LambdaDeploymentPipeline - have a look at it, it might be useful

I am not able to access that repo. Is it public?

@BrianFarnhill
Copy link

@AdamTylerLynch sorry that was my bad, realised I had a couple of account IDs in there and wanted to take them out. I've been rebuilding that demo in a bit of a different way recently (adds CodeArtifact in for custom CDK constructs too, but that does complicate things a little). It's a work in progress but the guts of that old repo is there again now, in this new URL.

https://github.com/BrianFarnhill/Demos.CDKApiPipeline

@samlaf
Copy link

samlaf commented Oct 4, 2021

@BrianFarnhill From what I understand, you are using:

I thought the whole point of cdk pipelines was that we didn't have to use aws_codepipeline, aws_codebuild, aws_codedeploy, etc. individually.

Is your reason for this choice that cdk pipelines is too limited to be useful alone at the moment? I for example noticed that cdk-pipelines don't seem to use CodeDeploy, so I'm still unsure how to rollback a stack (which is deployed via cloudformation changesets) after a unit-test fails.

@BrianFarnhill
Copy link

@samlaf I'm in a bit of a transition in that repo - I dragged everything forward to v2 of the CDK but haven't done the pipeline yet. I do however absolutely plan to use the newer pipeline construct for this though as that will be a lot cleaner from a code perspective.

My use of the the native code* resources is to add things to that core pipeline though, not provision the core resources themselves. For example, I use aws_codepipeline to give me the Artifact class, not to provision a pipeline manually. I use aws_codebuild to give me the ReportGroup and BuildSpec classes. My goal in using the CDK to is to minimise the amount of code I need to write to get to an outcome, and the CDK Pipelines stuff is a brilliant example of that - and where that module doesn't give me exactly what I need I have lots of ways to extend it and tweak it, so I still get the benefit of using the Pipelines module while still ticking all the boxes for my own requirements too.

So to answer the question specifically - the reason for my choice is that I just haven't gotten around to updating the pipeline yet, but absolutely intend to.

@samlaf
Copy link

samlaf commented Oct 5, 2021

Thank you @BrianFarnhill !
Thanks to your code I was able to add ReportGroups to my pipeline using CodePipeline Api, and I'll be looking to integrate many of your other features too. I watched your repo to get updates when you migrate to the new Api.

@github-actions
Copy link

github-actions bot commented Oct 5, 2022

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/pipelines CDK Pipelines library closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. documentation This is a problem with documentation. effort/large Large work item – several weeks of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

6 participants