One way of deploying our workload is to use containerization. To manage our containers in AWS we can use Amazon Elastic Container Service or Amazon Elastic Kubernetes Service. Both of those solutions will be presented in this article.
Containers:
- standardized unit that packages your code and its dependencies
- designed to run reliably on any platform, because it creates its own independent environment
AWS orchestration services
Amazon Elastic Container Service (Amazon ECS)
- end-to-end container orchestration service
- containers are defined in a task definition (text file, in JSON format, that describes one or more containers) that you use to run an individual task or a task within a service
- you can run your tasks and services on:
- serverless infrastructure managed by AWS Fargate/Fargate Spot – we pack the app into a container, define the CPU, memory, networking, IAM policy and run it
- cluster of EC2 instances managed by you. In this option you will need to install ECS container agent on EC2 instances, which will communicate management details to ECS cluster (EC2 instance + ECS container agent is often called container instance)
- core constructs:
- cluster – logical grouping of services and tasks
- service – one or more identical tasks
- task – one or more containers
- ECS cluster auto scaling:
- auto scaling group consisting of containers that we want to scale based on information from CloudWatch
- each auto scaling group is connected to a capacity provider and a capacity provider has only one auto scaling group. At the same time, multiple capacity providers can be connected to one EC cluster
Amazon Elastic Kubernetes Service (Amazon EKS)
- managed service that you can use to run Kubernetes on AWS without needing to install, operate, and maintain your own Kubernetes control plane or nodes
- if you already use Kubernetes, you can use Amazon EKS to orchestrate the workloads in the AWS Cloud
- you are still responsible for maintaining the underlying EC2 instances
Differences between Amazon EKS and ECS
- in ECS machine that runs the containers is an EC2 instance with ECS agent (container instance). In EKS the machine that runs the containers is called worker node or Kubernetes node
- ECS container is called task, EKS container is called pod
- ECS runs on AWS native technology, EKS runs on Kubernetes
In summary, AWS provides robust options for containerization through Amazon ECS and Amazon EKS. ECS offers a simplified, end-to-end container orchestration service, while EKS allows you to run Kubernetes without managing the control plane. By leveraging these services, you can efficiently deploy and manage your containerized applications in the AWS cloud.