8

I have a small nodejs application containing a web socket server. The app is hosted inside an ecs container so it is basically a docker image running on an ec2 instance.

The web socket works as expected over ws://. I use port 5000 for this.

In order to use it on my SSL secured website (https), i need to use a secured web socket connection over wss://.

To archive that I've created a certificate on aws (like many times before) and after I create a load balancer.

I tried an application load balancer, a network load balancer and the classic load balancer (previous generation).

I read a few answers here on StackOverflow and followed the instructions as well as some tutorials found using google.

I tried a lot without success. Of course, this takes a lot of time because the creation of a load balancer and other resources takes quite a bit of time.

How I create a load balancer on aws pointing to my instance with wss://. Could someone please provide an example or instructions?

dknaack
  • 60,192
  • 27
  • 155
  • 202
  • 1
    Create an application load balancer, associate a certificate with the listener on port 5000 (or, why complicate things? Use port 443...) and configure your target group, and you should be done. If it doesn't work, you'll need to review the logs from balancer and app and do some basic low-level troubleshooting and report on your observations. – Michael - sqlbot Feb 10 '18 at 21:59
  • 2
    Having this problem now. did you manage to make it work? – Moisés Mar 20 '18 at 17:04
  • 1
    Having exactly the same problem, did you find a proper ALB config for that? Please share. – MaxBlax360 Sep 05 '18 at 08:22

1 Answers1

0

The solution posted https://anandhub.wordpress.com/2016/10/06/websocket-ebs/ appears to work well.

Rather than selecting https and http, select the 'SSL' on port 443 and 'TCP' on your applications port (eg 5000)

enter image description here

You'll need to load your key/certificate via AWS and the loadbalancer will handle the secure part. I suspect you can not take advantage of 'sticky' features of the LB with this method.

Friggles
  • 634
  • 5
  • 7