Don't wait for Lambda deployment
When deploying a Lambda through CodeDeploy configure with, for example, LINEAR_10PERCENT_EVERY_10MINUTES, CDK will block waiting for the deployment to finish (and display the message "CodeDeploy deployment started".
CDK should just start the deployment and not wait for it to finish, since failing a Lambda deployment (and rolling it back) should have no bearing on the rest of the CDK deployment.
Reproduction Steps
const lambdaName = basename(__dirname)
export async function myLambda(stack: Stack): Promise<Alias> {
const f = new Function(stack, lambdaName, {
runtime: Runtime.GO_1_X,
handler: "main",
code: Code.asset(join(__dirname, "lambda.zip")),
})
const alias = new Alias(stack, lambdaName + "-alias", {
aliasName: "live",
version: f.addVersion(2),
})
new LambdaDeploymentGroup(stack, lambdaName + "-deployment", {
alias: alias,
deploymentConfig: LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_10MINUTES,
})
return alias
}
Error Log
CDK blocks in the UPDATE_IN_PROGRESS stage.
Environment
- **CLI Version : 1.18.0
- **Framework Version: 1.18.0
- **OS : macOS Catalina
- **Language : Typescript
Other
This is :bug: Bug Report
Hello @duarten ,
thanks for opening the issue, however I don't agree with this statement:
CDK should just start the deployment and not wait for it to finish, since failing a Lambda deployment (and rolling it back) should have no bearing on the rest of the CDK deployment.
In fact, if you're using the CodeDeploy blue-green Lambda support, the Lambda deployment failing does have a bearing on the rest of the CDK deployment. Both of those are managed through CloudFormation, which means if the Lambda deployment fails, the rest of your CDK resources in the CloudFormation stacks will be rolled back.
That's why we need to wait on the entire CloudFormation deployment - including any Lambda blue-green deployments.
Thanks, Adam
Thanks for the reply, Adam!
Let's say I'm deploying a Lambda that sees little traffic, and I configure a deployment group to linearly deploy 5% over 600 seconds. This means CDK will remain blocked for a week, which we can agree is not reasonable (especially when calling CDK through hosted CIs).
I think that in this case, what I want to deploy is the CodeDeploy's Deployment, not the Lambda itself.
Maybe this is more of a CloudFormation issue?
Maybe this is more of a CloudFormation issue?
I think so. If a lambda's deployment is supposed to take a week, then your CloudFormation deployment will also take a week.
Thanks! Do you have any guidance where I should post this issues/feature request?
On second thought, maybe it should be possible to configure just CDK to not wait for CloudFormation to finish? I assume you do so by calling the describe stacks API, in which case there could be an option to fire-and-forget the CF change, assuming the user has other ways of monitoring the deploy.
If you're using cdk deploy, I don't think it's a valuable feature to not wait for the deployment. You can of course deploy a CDK-generated CloudFormation template in other ways (CodePipeline, AWS CLI, etc.), and in those cases there will be no waiting.
I believe you need to go through AWS support to submit an issue to CloudFormation.
The advantage would be to only have to deal with CDK and no other tool. Ideally, I could specify which stacks to wait for and which to fire-and-forget (and I wouldn't mind contributing this code). Even more ideally, CDK could have hooks that would allow me to specify this programmatically, so that I could for example wait for a deployment only until CodeDeploy is done with the pre-traffic tests.
I'd be interested in this "fire-and-forget' avenue to support deployments of apps that contain stacks provisioning AWS Certificates, as certificates aren't "complete" until validated, a process that could potentially take a lot of time if it involves e-mail validation, and I don't want to hang up the rest of the deployment.
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.