Change alias name of lambda fails in combination with an ALB
See original GitHub issueIf you only change the alias name of an lambda which is linked by a target group of an ALB by it;s alias it fails updating:
…is still not stable
(UPDATE_ROLLBACK_IN_PROGRESS (The following resource(s) failed to update: [iapidevnecmastertg3403BAB0]. ))
12/18 | 6:36:11 AM | UPDATE_FAILED | AWS::ElasticLoadBalancingV2::TargetGroup | iapi-dev-nec-master-tg (iapidevnecmastertg3403BAB0) ElasticLoadBalancerV2 TargetGroup did not stabilize.
new TargetGroupBase (/tmp/jsii-kernel-3gxWH2/node_modules/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.js:31:25)
\_ new ApplicationTargetGroup (/tmp/jsii-kernel-3gxWH2/node_modules/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.js:15:9)
Reproduction Steps
- create a lambda with an alias X and add it to a TG of an ALB .2 then only change the name of the alias
private Alias createLambdaAlias(Function lambda) {
return Alias.Builder.create(this, LAMDBA_ALIAS_ID).aliasName(configuration.getLambdaAliasName())
.version(lambda.getCurrentVersion()).build();
}
private ApplicationTargetGroup createApplicationTargetGroup(Alias alias) {
LambdaTarget target = new LambdaTarget(alias);
ApplicationTargetGroup atg =
ApplicationTargetGroup.Builder.create(this, nameConvention.getAlbTargetGroupName())
.targetGroupName(nameConvention.getAlbTargetGroupName()).targetType(TargetType.LAMBDA)
.targets(List.of(target)).build();
atg.setAttribute(TG_ATTR_NAME_LAMBDA_MUTLI_HEADER_ENABLE, LAMBDA_MUTLI_HEADER_ENABLE);
// Make sure that the correct permission is set before adding it to the TG
Permission lambdaAlbPermission = createALBPermission(ALB_PERMISSION_ACTION, atg);
alias.addPermission(LAMBDA_FUNCTION_ALB_PERMISSON_ID, lambdaAlbPermission);
return atg;
}
Error Log
12/18 | 6:36:11 AM | UPDATE_FAILED | AWS::ElasticLoadBalancingV2::TargetGroup | iapi-dev-nec-master-tg (iapidevnecmastertg3403BAB0) ElasticLoadBalancerV2 TargetGroup did not stabilize.
new TargetGroupBase (/tmp/jsii-kernel-3gxWH2/node_modules/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.js:31:25)
\_ new ApplicationTargetGroup (/tmp/jsii-kernel-3gxWH2/node_modules/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.js:15:9)
Environment
- CLI Version : 1.39
- Framework Version:
- OS : linux
- Language : Java
Other
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Lambda function aliases - AWS Documentation
To change an alias to point a new version of the function, use the update-alias command. To delete an alias, use the delete-alias...
Read more >AWS Lambda Events - ALB - Serverless Framework
By default, target group names are strings generated by hashing a combined string of the function name, alb's id and whether multi-value headers...
Read more >13 AWS Lambda design considerations you need to know about
A single Lambda function that gets a new version number whenever there is a change to code or configuration. The alias will be...
Read more >terraform-aws-modules/lambda/aws | alias Submodule
Terraform module, which creates Lambda alias as well as takes care of async event ... Amazon Resource Name (ARN) of the destination resource...
Read more >lambda_http - Rust - Docs.rs
Enriches the `lambda` crate with `http` types targeting AWS ALB, API Gateway REST and HTTP API lambda integrations.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This caveat should at least be documented in the CDK construct, even if the underlying cause is CloudFormation? One of the selling points for CDK is the ability to refactor code, but if logical ID changes breaks CFN without notice that’s just very poor DX.
The workaround that @drice suggested worked perfectly for us (thanks), maybe that should be mentioned in the docs too?
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.