2

I have an application running on AWS EC2. In order to get high availability, we are planning to set up AWS Load balancer and host the application in a minimum of 2 EC2 instances.

We also heard about Docker swarm, in which we can create a service with 2 managers on 2 separate EC2 instances and the swarm will take care of the rest (instead of using ALB with 2 EC2). It will balance the load to all the containers inside the cluster and it also restarts the container if anything makes this go down.

So I want to know which is the best choice for my case. The application won't get heavy load/traffic. Why I choose load balancer is for high availability. If 1 instance goes down the other will be taken care of this.

If there are any other choices to fulfill my requirements, it will be highly appreciated. Thanks.

Neron Joseph
  • 1,675
  • 22
  • 39

1 Answers1

1

I presume it's a stateless application.

A combination of both Swarm & ALB is what you can go for but you will need to incorporate autoscaling etc sooner or later which means you will need to manage the swarm cluster & maintain it. With ALB you will get real good metrics which you will surely miss while using Swarm.

BUT, you do have a few better options which will manage the cluster for you. You just will have to manage & maintain the docker images -

  1. Use ECS.
  2. Use EKS (only in us-east-1 as if now)
  3. Use ElasticBeanstalk MultiContainer.

Ref -
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_ecs.html https://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html https://aws.amazon.com/eks/

vivekyad4v
  • 13,321
  • 4
  • 55
  • 63
  • By docker's routing mesh functionality, it will take care of the load balancing, right? I'm thinking about avoiding ALB if we are using Docker swarm. – Neron Joseph Oct 23 '18 at 07:04
  • Yes, it will but how will you manage at DNS level. What if instance get's crashed at kernel level etc. With ALB you can monitor health & also helps you manage DNS without many changes. I would suggest ALB at least in prod. Also, there are many configurations which you can set at ALB but might not in docker swarm VIP load balancing. – vivekyad4v Oct 23 '18 at 10:00