AWS Compute Services Comparison

Feature EC2 (Virtual Machine) ECS on EC2 (Managed Containers) Fargate (Serverless Containers)
What do you manage? The whole OS (AMIs, Patches, SSH). The EC2 instances AND the containers. Only the container and its resource needs.
Scaling You scale the VM. You scale the VM and the containers. You scale the number of tasks; AWS handles the rest.
Pricing Pay per hour for the instance (even if idle). Pay for the EC2 instances you run. Pay only for the CPU/RAM the container uses.
Customization Highest. Full root access to the OS. High. You can use custom AMIs for the hosts. Low. You cannot log into the "host" server.
Setup Speed Minutes (booting a VM). Moderate (setting up clusters). Fastest. Just give it a Docker image and go.
Why use Fargate instead of EC2?

When should you NOT use Fargate?
Even though it sounds perfect, you’d stick with EC2 (or ECS on EC2) if:

Summary:

Service Best For... Unit of Work Management Level
EC2 Total control / Legacy apps Virtual Machine High (You manage OS)
ECS/EKS Complex microservices Container Medium (Orchestration)
Fargate Containers without servers Container Low (Serverless)
Lambda Event-driven "snippets" Code Function Minimal (Serverless)
App Runner Quick Web Apps/APIs Container Minimal (Automated)
Lightsail Simple sites / Fixed budget Virtual Machine Low (Simplified)