To make Kubernetes work at scale, you need a container orchestration tool that automates the management, deployment and scaling of your clusters.
If you’re running Kubernetes on AWS, you can choose from several options:
- Elastic Container Service (ECS)
- Elastic Kubernetes Service (EKS)
- AWS Fargate
Which one is the best match for your workloads that helps to reduce your AWS bill? Read on to find out.
What is Elastic Container Service (ECS)?
ECS is a scalable container orchestration platform AWS that runs, stops, and manages containers in a cluster. The containers are defined as part of Task definitions.
You can use ECS with EC2 instances or AWS Fargate.
ECS + EC2 instances
- You take care of security patches, network security, and scalability in the cluster (fortunately, you can use Kubernetes autoscaling mechanisms)
Cost: You pay for EC2 instances and VPC networking.
ECS + AWS Fargate
- No need to manage servers
- AWS takes over container availability and scalability. Tip: To avoid your application becoming unavailable, pick the right CPU and memory combination
- Fargate Spot allows running interruption-tolerant ECS Tasks at up to 70% reduction off the Fargate price
- ECS + Fargate supports only one networking mode (awsvpc), limiting your control over the networking layer
Cost: You pay for the CPU and memory you’ve selected.
What is Elastic Kubernetes Service (EKS)?
EKS provides and manages a Kubernetes control plane for you. To run a workload, EKS establishes the control plane and Kubernetes API in your managed AWS infrastructure.
- No need to install, operate, and maintain your own control plane
- You can run workloads using native K8s tools like kubectl, Kubernetes Dashboard, Helm, and Terraform
- Automates load distribution and parallel processing better than human engineers
- All Kubernetes assets integrate seamlessly with AWS services and applications running on EKS are compatible with those in your Kubernetes environment. You can migrate to EKS without changing the code
- Deployment requires expert configuration
- Choose it if you’re ready to handle the scalability level of Kubernetes
What is AWS Fargate?
AWS Fargate takes over the server management tasks like booting a server, installing the agent, and ensuring that everything is up-to-date. Create a cluster, add your workload to it, and Fargate will add pre-configured servers to support your requirements.
But here’s what you should know about Fargate:
- Not a good match for highly regulated environments where teams use dedicated tenancy hosting
- With ECS, Target supports only one networking mode (awsvpc) that comes with its limitations
- You don’t have full control over how Farget allocates resources. If you fail to monitor it, you might be looking at increased costs
AWS EKS vs. ECS – Key differences
AWS EKS vs. ECS – Example cost comparison
When to choose EKS?
- When you need granular control over placing your containers
- When you require more networking modes
- When you want to have more control over your tooling
When to pick for ECS?
- When your DevOps expertise and resources are limited
- When you don’t have time or resources to choose from many different add-ons (ECS offers only one option in each category)
- When Kubernetes is too complex for you right now
Optimise Kubernetes costs with an automation solution
ECS is a good solution for those taking their first step into the world of containerisation. You can easily move your Kubernetes workloads into a managed service without making a large upfront investment.
But if control and flexibility of moving across different cloud services are more important to you, and you have experience in Kubernetes, EKS is a better solution. You’re then free to integrate your applications with the open-source Kubernetes tooling.
Whether you pick ECS, EKS, or Fargate, you still need a solution that helps to analyse and optimise cloud costs.
If you’re looking for something that helps in running clusters on EKS and cuts costs for you, check out the EKS Optimizer – analyse your cluster, generate a Savings Report, and then keep on optimising your AWS bill automatically.
Editor’s note: This article is in association with CAST AI.