post-thumb

Amazon ECS vs EKS vs Fargate: Which Service is Right for You?

What is ECS?

ECS is a fully managed container service on Amazon. You don’t need to worry about how to scale out pods or nodes as the traffic grows.

Basically, AWS helps you to manage backends to automatically scale capacity and ensure availability.  

Prons

  • Automatically scale-out pods and nodes, no need to worry about how to scale out. 
  • No need to manage pods or EC2 nodes.
  • Easy to set up by AWS Admin UI.   
  • No need to update the version for ECS.

Cons:

  • Hard to debug and impossible to check the error logs without setting up logs in CloudWatch.
  • Having lots of steps to set up in AWS Admin UI.  
  • Performance is not as good as EKS. 

Though ECS is very easy to use, the main concern is you cannot check error logs when your pod fails to start due to unexpected exceptions.

What is worse, if you don’t set up CloudWatch Log properly, there will be no logs to diagnose this problem.

Your task will be disappeared in AWS Admin UI which makes it hard to debug and will take too much time on troubleshooting. 

Regarding the performance, ECS is controlled by AWS and is like a black box. You don’t know how AWS scales your microservices by what kinds of an indicator like CPU or Memory utilization. 

If you have spike traffic, ECS could not autoscale services as good as EKS to ensure high performance.  


What is EKS?

EKS is half of the managed services. AWS helps you to manage the control plan of Kubernetes while you only need to manage the data plan. This means you still need to manage your EC2 nodes and set up how to horizontally scale out pods and nodes to meet the growing traffic. 

Therefore, you can fully control the backends to achieve the best performance and diagnose any kinds of errors in kubectl command.

Prons:

  • Fully control the cluster, you can diagnose any kinds of errors to shorten the time in troubleshooting.
  • Easy to tweak the CPU or Memory in Autoscaler to achieve the best performance as the traffic grows.

Cons:

  • Need to have some knowledge of Kubernetes and EKS.
  • Hard to set up EKS Cluster and Application Load Balancer Ingress.
  • Need to manage EC2 nodes and pods for scalability. 
  • Need to manually update the version for EKS’s cluster.

On the downside, you need to have some knowledge of kubectl and know how to design its architecture. EKS is like a manual car while ECS is an automatic car. EKS gives you full power and speed but you need to learn how to control it and tweak the auto-scaler. 

EKS is very hard to set up in the beginning, but once you get used to those scripts. Then it’s not a complicated task. 

Updating the last version of EKS might be an annoying task. Usually, you only need to update it once every 6 months or even 1 year.

You can use route53 to dispatch traffic to the latest version of EKS or the old one. Remember you need to validate and test the latest version of EKS to make sure it won’t break existing features. 


What About Fargate?

Fargate is a fully managed service, no need to worry about scale our or manage EC2 nodes.

Prons:

  • Fully managed service, no need to manage pods for scalability.
  • Costs are higher than EC2 if you keep Fargate tasks running for 24 hrs. 

Cons:

  • Start-up time is long
  • Performance is not good to deal with spike traffic 

Fargate is suitable for some tasks that require high computing resources in a short period of time such as batch services or machine learning tasks.

Not suitable for those APIs that require high performance for growing traffic. Because Fargate needs to spend a long time to fork a new Fargate task. During that period of time, API will return 500 errors at peak traffic. 


Conclusion

You should know the tradeoffs in ECS, EKS, and Fargate on AWS. Choose the one to better meet your needs and save your time.


You might be interested in

How to implement Singed Cookies in Unity with CloudFront? 

How to reverse engineer C# and Unity3D Games??