EC2 with ECS (ECS container instance)
An ECS container instance is nothing more than an EC2 instance that runs the ECS Container Agent. The EC2 instance is owned and managed by you. The instance appears in the list of EC2 instances like any other EC2 instance. The ECS Container Agent regularly polls the ECS API if new containers need to be started or stopped. Usually, you run a cluster of container instances in an auto-scaling group. ECS is free of charge. You only pay for the EC2 instances. The downside is that you have to scale, monitor, patch, and secure the EC2 instances yourself. Especially the scaling is not easy because:
- There is no obvious metric to scale the cluster and no integration to scale when the task placement fails because of insufficient capacity.
- The auto-scaling group and ECS are not aware of each other which makes task deployments very hard during cluster scale in or rolling updates via CloudFormation 202007061337 .
- You have to scale down without killing running tasks which is an even more significant challenge for long lived tasks.
Comparison with Fargate
Pros
Significantly cheaper for very predictable workload at higher scales (See pricing information for EC2 here)
Cons
It’s difficult to scale EC2 container instances; Fargate takes care of scaling, so has lower operational cost.
Created from: Project overview 202007010930
uid: 202007011438 tags: #amazon