Docker has been around for more than a decade. Since then, many applications have been used it. It also has a significant role in the recent boom of microservices. Therefore it is essential to understand how docker builds one and deploys it into the cloud. This time we will look into how to deploy docker in AWS, the largest cloud provider right now.
When you search in google on how to deploy docker in AWS, chances are you will find AWS ECS (Elastic Container Service). In my opinion, it is a good service, if you don't mind the complexity. However, if you are starting and want to deploy it, there may be another way that you will find fit.
Simple compute service
While some people may say that using a server to deploy docker is outdated. It is the simplest way to get your application started and running. If you want to know more about AWS and its concept, I suggest you use EC2 (Elastic Container). But if your only interest is getting stuff running, there is a service called AWS Lightsail.
Platform as a service with AWS Elastic Beanstalk
AWS Elastic Beanstalk helps developers focus on applications by offering a way to quickly deploy and manage applications in the AWS Cloud without learning about the infrastructure that runs those applications. Elastic Beanstalk reduces management complexity without restricting choice or control. You upload your application, and Elastic Beanstalk automatically handles the details of capacity provisioning, load balancing, scaling, and application health monitoring.
For deploying docker, AWS Elastic Beanstalk offers two types of platform branches. One is called docker, Running on 64bit Amazon Linux 2, and the other is called ECS, Running on 64bit Amazon Linux 2. If you want to get your application started but with some AWS infrastructure behind it, use
Docker Running on 64bit Amazon Linux 2. It will create EC2 for you. On the contrary, choose the latter if you want to build it on ECS so it can be scalable.
The Famous Elastic Container Service
ECS is renowned for some reasons. For many things that ECS does, like managing and orchestrating many containers, health checks, and multi-availability zone clusters, ECS is straightforward and easy to understand, in my opinion. Not to mention it work great with a serverless container service named Fargate. That is if you know AWS.
To build an ECS cluster, you will need to understand how to make EC2 and set up a network in VPC so that ECS can communicate with its agent. Also, you don't want a security issue, so you set up a firewall called a security group. Because you are dealing with a cluster, you will need a load balancer. Besides that, there is also Code Pipeline to build CI/CD and Elastic Cloud Registry (ECR) to store your image before it can be used by ECS.
ECS is an excellent service if you know what you are doing.
Kubernetes with Elastic Kubernetes Service
I only can recommend EKS if you are both comfortable with EKS and Kubernetes. While I said that ECS is a simple service if you know AWS, EKS is, in my opinion, complex even if you know AWS. Learning Kubernetes alone may take some time. The merit that I can think of if that Kubernetes is open source which many cloud providers offer. It gives us the flexibility to change, and because it is open source and widely known, it has a broader appeal for hiring.
There are many ways to deploy docker, and I think it is caused by the broad need to deploy docker. For instance, someone may want to deploy it without much thinking, but others may need more control over the infrastructure. I am trying to say there are no wrong choices or services.
Did you find this article valuable?
Support Alvin Endratno by becoming a sponsor. Any amount is appreciated!