aws / aws/aws-cdk

(aws_elasticloadbalancingv2): Add support for TLS on NLB Listeners with ALB Targets

Open
#22,245 4 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-elasticloadbalancingv2 feature-request needs-cfn p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

When trying to utilize [NLB's feature of having ALB target types](https://aws.amazon.com/blogs/networking-and-content-delivery/application-load-balancer-type-target-group-for-network-load-balancer/), I would like ALB Targets on NLB Listeners to have TLS termination.

```TS
const applicationLoadBalancer = new ApplicationLoadBalancer(...);
const listener = nlb.addListener("NLBListener", {
port: listenerPort,
protocol: ElbProtocol.TLS, // TLS Listeners on ALB Target Groups not supported. This will throw an error at deployment.
sslPolicy: SslPolicy.RECOMMENDED,
certificates: [{ certificateArn: props.acmCertificate.certificateArn }],
});
const albTarget = listener.addTargets("ALBTypeTargetGroup", {
targets: [
new AlbTarget(applicationLoadBalancer, listenerPort),
],
port: listenerPort,
healthCheck: {
path: "/healthcheck",
port: "traffic-port",
protocol: ElbProtocol.HTTPS,
},
});

```

Trying to synthesize and deploy the above will result in the following error:
```
Error: The stack named failed to deploy: UPDATE_ROLLBACK_COMPLETE: Target type 'alb' is not supported for target groups with TLS protocol (Service: AmazonElasticLoadBalancing; Status Code: 400; Error Code: InvalidConfigurationRequest; Request ID: aca076e1-3d00-40ae-b12a-cf9b2c171cd2; Proxy: null)
```

### Use Case

I'm building an ECS/Fargate service with the following requirements:
1. Use PrivateLinks (So an NLB is absolutely necessary to front my service).
1. Have weighted traffic between a "preproduction" and a "production" stage. In short, I have multiple target groups that I need to direct weighted traffic to. In this case the "preproduction" service will get 5% of traffic, while the "production"
target gets 95%.
1. I need TLS termination at the Network Load Balancer.

With all these requirements, I have ended up utilizing the NLB -> ALB solution provided by AWS recently. However, TLS termination is seemingly impossible. Even in [the linked blog post](https://aws.amazon.com/blogs/networking-and-content-delivery/application-load-balancer-type-target-group-for-network-load-balancer/), there is a caveat that NLB listeners on ALB targets cannot have TLS. Their workaround is to use HTTPS protocol, but even that does not work!! HTTPS is [not a supported protocol on NLB Listeners!!!](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.NetworkListener.html#protocol). So this feature release is misleading, TLS termination is not possible at all with this NLB -> ALB approach.

### Proposed Solution

_No response_

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.14.0

### Environment details (OS name and version, etc.)

AL2

Contributor guide

Open the contributing guide

Research direction

Start from the NetworkListener/addListener and AlbTarget usage shown in the issue, then verify the AWS service constraint behind the deployment error and the CDK API's current protocol validation. A complete change would need a supported path for TLS NLB listeners with ALB targets, with focused coverage and user-facing behavior established; if AWS still rejects it, document that limitation instead.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.