-
Notifications
You must be signed in to change notification settings - Fork 4k
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
CodePipeline AND Local Deployments of Lambdas #6159
Comments
Hey @jamiepmullan , thanks for opening the issue. This is a common question, and I'd figured instead of pasting a ton of code here, I'll create a brand-new CDK project showing how to achieve that: https://github.com/skinny85/cdk-codepipeline-and-local-lambda-guidance Let me know if this helps! Thanks, |
Hey @skinny85 |
Hey @skinny85
Looks like you've already commented in #4928 that we are blocked until #3437 is delivered. |
Yes, things that use assets internally, like DNS validated certificates, are blocked until #3437. As an alternative, you can use the the layer 1 class for the certificate ( |
Hey @skinny85 - quick clarification question... What I want to be able to do is:
My question... only way I can think about doing this is by appending the github hash ID on to the stack name, but can't see a way of doing this... what is your opinion on this? Is there anything else you can suggest? Let me know if I need to clarify this... |
@jamiepmullan just have 2 instantiations of your Stack classes: new ApiGwStack(app, 'DevStack');
new ApiGwStack(app, 'ProdStack', {
route53records: ... // optional property
}); |
@skinny85 Not a good idea to stand up a side-by-side stack and just migrate traffic to the new stack? (then destroy the old eventually), instead of deploying the infrastructure twice in a CodePipeline as you mentioned in your previous comment? |
How would you do that? I don't think having a test stack, with an integration test that checks it before deploying production, is anything unusual... |
@skinny85
The way I imagined this working was to allow us to do blue/green deployments on stacks as a whole, instead of just individual resources/lambda's. Meaning we're testing the actual stack and infrastructure, before we promote to live (without having to redeploy everything again, we're just changing the dns). I think the only way of doing this is having a custom CodeBuild that literally runs One of our use cases that we need to be able to keep the old stack still alive i.e. not destroy/replace it. |
This is what I was asking before. How are you doing that? |
I don’t think it’s possible at the moment to create stacks in this way... but we would to do it in this way. It’s kinda terraform-ish! |
Sorry, you lost me :( |
❓ How can you deploy lambdas locally, but allow a Lambda Deployment Group in the pipeline to also deploy to them (i.e. through Cloudformation in the CodePipeline)
The Question
I've been trying to get a configuration working of my CDK app where I can deploy all my infrastructure from local, but also have the lambdas automatically update on a code release.
Setup:
I've recently started from the beginning to see if there was an easy way around it, following: https://docs.aws.amazon.com/de_de/cdk/latest/guide/codepipeline_example.html
So I have an application where I have a mixture of SNS, lambdas, API gateway etc. but also have my Pipeline configuration consisting of GitHub Source, CodeBuild, CdkBuild to get the template, and CloudFormationCreateUpdateStackAction.
This is 3 stacks in total:
This is a bit more complicated than what the example in the documentation shows because we have to share resources across multiple stacks to assign lambdas to api gateway for example.
To try and get round it I've got a context variable (set on cdk command) called 'inPipeline' to see if its being run from the pipeline, or locally in a bid to try and set my lambda code to just a Code.asset('') value if in fact local. However because we have the dependency on CfnParametersCode in other stacks, it quickly breaks when you try deploy it with no asset being set (i.e. its local so there isn't one!).
Has anyone else has approached this differently? Or have any suggestions?
I guess the problem here is that I want to allow a lambda to have multiple code sources which isn't going to work.
I can't think of any other way than just putting the whole App creation into the pipeline.
Guess a couple of other alternative would be:
cdk deploy
but that will do the whole AppEnvironment
Other information
The text was updated successfully, but these errors were encountered: