Renan Geraldo
Renan Geraldo

Reputation: 655

How to create an scalable Websocket application using AWS elb?

I am developing an Websocket application and I am having doubts on how to create a scalable application.

1- Should I use Nginx? And if so, where does nginx stand? It would be like this:

ELB -> Nginx -> Ec2 instances

or

Nginx -> ELB -> Ec2 instances

2- Is it necessary to use a service like Redis to make the communication between servers? Example: I am connected to server1 and my friend is connected to server2, but we are in the same room chat. If I send a message, it needs to reach my friend.

3 - Is it possible to let my Elb receives only calls in https but the conversation with the backend is http? I ask this, because I use OpsWorks and it was very hard to normalize cookbooks to create my environment.

Thank you.

Upvotes: 0

Views: 224

Answers (1)

Prabhat
Prabhat

Reputation: 4426

  1. Generally the architecture looks like:

ALB --> nginx1,niginx2 --> ALB --> ec2 websocket server1, server2

This allows your web servers and app servers to be load balanced independently of each other

  1. Not necessarily. Redis is used primarily as an in memory data store for caching.

  2. Yes - You can terminate ssl on ALB and it is in fact recommended to do it this way in order to offload ssl processing on load balancer as opposed to doing it on instances themselves. See - https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html . Additional benefit of using this is that you can use ACM to issue certificates for free that can be deployed on ALB. ACM can handle renewals for you automatically as well.

Upvotes: 1

Related Questions