ECS vs EC2 vs Lambda
In this comparison article, we’ll be looking at three different computing services on AWS, namely, Amazon Elastic Container Service (ECS), the service for running Docker containers on AWS, Amazon Elastic Compute Cloud (EC2), and AWS Lambda. These services take up a huge part of the AWS exams, so make sure to learn them well because you’ll definitely need to know them in-depth to pass the test!
Let’s talk about IaaS, CaaS, and FaaS before jumping into each of the related AWS services.
Something… as a Service
Infrastructure as a Service (IaaS) is the cloud service model that says “We’ll manage the data center but you have to manage your own services.” AWS accomplishes this by providing IaaS services like Amazon EC2 so that users can provision servers without having to buy server racks themselves and then pay utilities/rent required to run a data center. This allows users to save tons of money upfront. If you’re used to working with “Virtual Machines”, think of IaaS as managed virtualization infrastructure so you only need to look after the VM.
Out of the three service models we’ll be talking about in this article, IaaS is perhaps the most intuitive, so let’s not spend too much time on IaaS and move on to containers.
Containers as a Service (CaaS) is a bit different from IaaS in that you have the option to go serverless with AWS Fargate. “Serverless” means that you don’t have to provision or manage the underlying servers in order for your application to work. AWS Fargate is Amazon’s serverless service for running Docker containers. If you’re not sure what containers are, you can just think of them as miniature instances that are very resourceful and designed to carry out specific computing tasks. AWS provides CaaS services with Elastic Container Service (Amazon ECS), Elastic Kubernetes Service (Amazon EKS), and AWS Fargate. We’ll talk more about the details of these services below. But first, let’s introduce our last main subject, functions!
Functions as a Service (FaaS) takes the concept of serverless further by saying “You just give me the code you want to run and I will take care of ALL the management and provisioning of resources.” Function computing is essentially on standby, meaning that it’s always ready to run. But FaaS services on AWS, such as AWS Lambda, only charge for the time the code is actually running, making it a cost-effective solution for most use cases. With Lambda, users provide code and then Lambda makes sure that code is run when invoked by a request. Lambda is FaaS at its finest.
So…which one should you use?
You might be wondering, “If functions are so cost-effective why wouldn’t businesses always use Lambda as opposed to containers or instances?” Similarly, you could ask, “Why should I use instances when I can always just use containers instead?” These are great questions to be asking and if you’ve had similar thoughts while reading this article that shows you’re thinking along the right lines!
One important thing to remember about AWS services is that, despite all the wonders of the cloud, each product still has its own limitations. Sure, there’s a lot of overlap between EC2, containers, and Lambda but each computing service can’t do it all. Therefore, it’s incredibly important to learn the benefits and use cases of each. So, let’s start by looking at Amazon’s original computing service, Amazon EC2.
Amazon EC2, “ya basic”
And you know what, that’s great!
With Amazon Elastic Cloud Computing (EC2), users can have a full-fledged server that runs 24/7 without having to physically manage or maintain the infrastructure needed to run it. Users simply select an Amazon Machine Image (AMI) to get started right away. An AMI is a server template that tells AWS what operating system, packages, and other settings to give the server at launch.
Shortly after choosing your AMI starting package, you’ll also get the opportunity to adjust the power of your EC2 instance. You’ll define the vCPU, memory, and other related configurations by choosing the “instance type”. If you decide you don’t want your instance anymore, that’s not a problem either. On AWS you can quickly start, stop, terminate, and launch a new one with a simple click of a button. That’s the power of the cloud.
In our courses, you’ll learn more about EC2-related services such as: Network Access Control Lists, Security Groups, Subnets, Auto-scaling Groups, and Elastic Load Balancers. All of the aforementioned services have a direct impact on how EC2 works and allow users to tailor the perfect solution for any given scenario.
Sometimes working in the cloud feels a lot like building with Legos, each piece in and of itself might not seem like much but combined together they can create something truly amazing! This is especially true when it comes to EC2 and containers.
Checkout out a couple of our exam-specific cheat sheets to learn more:
Uncontainable Containers
Containers are the “hot new thing” that’s gaining popularity throughout the IT world due to their cost-effective computations. As monolithic applications continue to be replaced by microservice applications, it’s only a matter of time before container usage becomes more prevalent than instance usage. Docker.com defines containers as “a standard unit of software that packages up code and all its dependencies so [an] application runs quickly and reliably from one computing environment to another.” Put simply, containers are standardized, lightweight, and secure pre-packaged solutions that run efficiently no matter what situation they’re thrown into.
It’s important to know that the idea of containers isn’t unique to AWS. Not only does each major cloud platform have its own container service but containers can be run without a cloud provider as well. But for the purpose of this article, we’ll be focusing on how containers are run on AWS through services like ECS, EKS, and AWS Fargate.
Amazon Elastic Container Service (ECS)
ECS “is a fully managed container orchestration service that helps you easily deploy, manage, and scale containerized applications.” (AWS) One of the great things about ECS is that, since it’s an AWS native service, it can easily integrate with the rest of your AWS environment. For example, you could run WordPress on Amazon ECS or on AWS Fargate and have Amazon EFS as your storage solution without running into any compatibility issues, just as this AWS article discusses here. Speaking of AWS Fargate…
AWS Fargate
Fargate is a serverless compute solution for containers that removes the need for users to have to provision and manage servers, thus allowing users to focus on building their application. Users give up granular configuration of the compute engine in exchange for convenience. But just because they have less control doesn’t mean they’ll overpay for anything. In fact, just the opposite is true! Fargate will ensure that a user’s application has the right compute capacity to run with no over-provisioning or wasted resources.
Recommended by LinkedIn
Amazon Elastic Kubernetes Service (EKS)
In order to understand EKS, you have to first understand what Kubernetes is. “Kubernetes is an open-source container orchestration engine for automating deployment, scaling, and management of containerized applications” (Kubernetes.io) that was originally started by Google. Kubernetes is an open-source software available for use by everybody and is well known as the tool that makes using containers at scale easier to manage. AWS makes Kubernetes available for use on their platform through Amazon EKS.
Checkout out a couple of our exam-specific cheat sheets to learn more:
It’s Lambda, not “Lame-da”
Lambda, Lambda, Lambda… If you haven’t heard about it yet, brace yourself. You’ll start seeing it pop up everywhere you look in the AWS world, and for a good reason too! AWS Lambda is the king/queen of convenience. With EC2 and Fargate you still have some type of control over the compute engine but with Lambda you forfeit all control for a totally hands-off experience. Submit your code, set the situations for which it’ll be invoked, and sit back, relax, and enjoy the show!
Not only do you avoid server management with Lambda but you also have continuous scaling. This means that no matter how many people are using your function (default is 1,000 concurrent uses but can be extended to tens of thousands), Lambda will grow to meet the demands. It will also remain cost-effective as it maintains constant performance for all the time it is invoked making it a perfect tool for data processing, real-time file processing, and machine learning, (to name a few).
Checkout out a couple of our exam-specific cheat sheets to learn more:
Let’s compare each of the computing services we’ve covered in the table below:
AWS Computing Summed Up
I hope that helps you understand the differences between ECS vs EC2 vs Lambda! Of course, we can only cover so much in an article but check out our AWS courses for video lectures and hands-on labs to really learn how these services work.
Check out our AWS Training Courses!
At Digital Cloud Training we provide the highest quality AWS training courses in the market at affordable prices. Our training options include:
Check out our catalog of courses now to get started with your AWS certification journey.
Got Questions?
Contact us here.
This post originally appeared on https://digitalcloud.training/ecs-vs-ec2-vs-lambda/
Good overview...
DevOps Lead | Woolworths Group
3yNeal Davis Good one!
Consultant Specialist | 3x AWS Certified | 2x Red Hat Certified Specialist | OpenShift Administrator | AWS | Containers and Kubernetes | DevOps
3yNice read
I've helped over 1 million cloud enthusiasts build hands-on skills and elevate their careers 🚀 Founder of Digital Cloud Training | AWS Community Builder | Cloud Solutions Architect | Udemy Instructor Partner
3y#aws #amazonwebservices #awstraining #awscertification