Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws-ecs-patterns) ALB pattern sets protocol/port to HTTP/80 when attaching certificate

See original GitHub issue

when attaching the certificate to ApplicationLoadBalancedEc2Service or ApplicationLoadBalancedFargateService target group is not changing to HTTPS and 8443 Target group , port and protocol is defaulted to HTTP and 80

export interface ApplicationLoadBalancedServiceBaseProps {
    const `**targetProps**` = {
      port: 80

    if (props.certificate !== undefined && props.protocol !== undefined && props.protocol !== ApplicationProtocol.HTTPS) {
      throw new Error('The HTTPS protocol must be used when a certificate is given');
    const protocol = props.protocol !== undefined ? props.protocol : (props.certificate ? ApplicationProtocol.HTTPS : ApplicationProtocol.HTTP);

    this.listener = this.loadBalancer.addListener('PublicListener', {
      open: true
    this.targetGroup = this.listener.addTargets('ECS', **targetProps**);

Its a problem when your docker application is running on 8443 there should be a way in the “ApplicationLoadBalancedServiceBase” class to override the port .

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

sep76commented, Feb 5, 2021

Have the same problem. that the container port override the Targetgroup port is understandable. But it still tries HTTP on a HTTPS container port. are there any workarounds ?

serge-komogorov-idealocommented, Feb 4, 2022

@nickorka, protocol: ApplicationProtocol.HTTPS, where ApplicationProtocol comes from @aws-cdk/aws-elasticloadbalancingv2

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws-cdk/aws-ecs-patterns module - AWS Documentation
If you need to encrypt the traffic between the load balancer and the ECS tasks, you can set the targetProtocol to HTTPS ....
Read more >
AWS Load Balancer HTTPS Setup with Route 53 ... - YouTube
In this video we will set up Load Balancer for HTTPS traffic with AWS Certificate Manager, and Route 53. We will also learn...
Read more >
AWS EKS Kubernetes ALB Ingress Service Enable SSL
Implement SSL with ALB Ingress Service on AWS EKS. ... are going to create a SSL certificate; Add Annotations related to SSL Certificate...
Read more >
Top 5 @aws-cdk/aws-ecs-patterns Code Examples - Snyk
Learn more about how to use @aws-cdk/aws-ecs-patterns, ... fromEcrRepository(imageRepo, tag) // Lookup pre-existing TLS certificate const certificateArn ...
Read more >
Unable to attach ACM Public certificate with ALB Listener ...
I have fixed this issue, after getting ACM cert, you have to validate after some wait time. you can use following code snippet:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found