Search code examples
amazon-web-servicesdockeramazon-ec2docker-swarmaws-alb

AWS ALB vs Docker swarm


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.


Solution

  • 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/