Containers and serverless: ECS, EKS, Fargate, Lambda

How containers differ from virtual machines, how Amazon ECS, Amazon EKS, AWS Fargate and Amazon ECR run them, and what serverless means with AWS Lambda.

GazeekAWS CLOUD PRACTITIONER·LESSON 16
LESSON 16

Containers and serverless: ECS, EKS, Fargate, Lambda

How containers differ from virtual machines, how Amazon ECS, Amazon EKS, AWS Fargate and Amazon ECR run them, and what serverless means with AWS Lambda.

0:00 / 4:30

After this lesson you can

  • Compare containers with virtual machines
  • Distinguish Amazon ECS from Amazon EKS
  • Explain what AWS Fargate and Amazon ECR do
  • Describe what serverless means and when AWS Lambda fits
  • Compare running code on Amazon EC2 with AWS Lambda
Transcript

Containers and serverless: ECS, EKS, Fargate, Lambda

G'day mate. Space Llama here. Last time, we ran whole virtual servers. Today, we get smaller. We'll compare containers with virtual machines, then meet ECS, EKS, Fargate and ECR. Then serverless, and AWS Lambda, where the servers stop being your problem.

Containers vs virtual machines

A virtual machine, like an EC2 instance, runs a whole operating system of its own. Containers are lighter. They share the operating system kernel of the host they run on. So they're small, and they start in seconds. A container image packages your app together with everything it depends on. That means it runs the same on your laptop, in testing and in production.

Amazon ECS vs Amazon EKS

Running lots of containers needs orchestration: starting them, placing them, replacing failed ones. Amazon Elastic Container Service, or ECS, is AWS's own container orchestration service. It's simple to use and deeply integrated with other AWS services. It runs your containers on EC2 instances, or on Fargate. Amazon Elastic Kubernetes Service, or EKS, is managed Kubernetes. Kubernetes is open source, so you use the same tooling and skills as anywhere else. EKS can also run on EC2 instances or on Fargate.

Fargate and ECR

AWS Fargate is serverless compute for containers. You say how much CPU and memory a container needs, and Fargate runs it. No servers or clusters of instances to manage. It works with both ECS and EKS. Amazon Elastic Container Registry, or ECR, is a managed registry where you store your container images. ECS, EKS and Fargate pull their images from it.

What serverless means

Serverless doesn't mean there are no servers. It means they're AWS's problem. There are no servers for you to provision, patch or look after. It scales automatically, up with demand and back down again. You pay for what you use, not for capacity sitting idle. And high availability is built in. Lambda and Fargate are serverless. So are Amazon S3 and Amazon DynamoDB.

AWS Lambda

AWS Lambda runs your code without you managing any servers. You write a function in a language like Python, Java or JavaScript, and upload it. It runs when an event triggers it. A file lands in S3, a message arrives in a queue, or a web request comes in. Each run can last up to thirty minutes. That was fifteen until late twenty twenty-six, so older practice questions may still say fifteen. Either way, Lambda suits short tasks, not long ones. You pay for the number of requests and the compute time your code uses, measured in milliseconds.

Amazon EC2 vs AWS Lambda

So how does Lambda compare with EC2? With EC2, you manage the server and its operating system. It runs as long as you like, for days or years. And you pay while the instance is running, busy or not. With Lambda, AWS manages everything except your code. It runs in response to events, then stops. And you pay only when your code is actually running.

Recap

Let's recap. Containers are lighter than virtual machines, and run the same everywhere. ECS is AWS's own orchestrator. EKS is managed Kubernetes. Fargate runs containers for both, without servers to manage. ECR stores your container images. And Lambda runs short functions when events happen. You pay only while they run.

Practice and what's next

That's containers and serverless. Small boxes, and fewer chores. Practice Cloud Technology and Services questions in Gazeek Flash's AWS app. It's free on the web and on Android, at flash.gazeek.com. Next up, storage. S3, EBS, EFS and friends. See you there.

Gazeek Flash · free

Exam questions on your phone

Free questions on Cloud Technology and Services: quick-fire batches and timed exams, on the web or Android.