EC2(Elastic Compute Cloud) is a compute service provided by AWS. But this is not the only compute service provided by AWS and also EC2 service is not suitable for all the use cases.
To meet the various use cases, AWS provides various computing services.
AWS Lambda is a serverless computing service. The users don’t need to worry about the underlying architecture or operating system. The term “serverless” means that your code runs on servers, but you do not need to provision or manage these servers.
While using AWS Lambda, you pay only for the compute time that you consume. Charges apply only when your code is running. You can also run code for virtually any type of application or backend service, all with zero administration.
Lambda’s a service that allows you to upload your code into what’s called a Lambda function. Configure a trigger and from there, the service waits for the trigger. When the trigger is detected, the code is automatically run in a managed environment.
If the users aren’t ready for serverless or they yet need access to the underlying environment and they still want the efficiency and portability then AWS provides ECS(Elastic Container Service) and EKS(Elastic Kubernetes Service) services.
Container: Container is nothing but a package of your application code or software and its dependencies and also its configurations.
ECS (Elastic Container Service): ECS uses docker for managing the containers in the system and all these containers are deployed on the EC2 instances and the user can still access the underlying hardware or OS.
EKS(Elastic Kubernetes Service): EKS uses Kubernetes for managing the fleet of instances. It works the same as ECS.
Container Orchestartion: Container Orchestration is the process of managing the lifecycles of containers, especially in large, dynamic environments.
This includes a wide range of things software teams need to manage a container’s lifecycle, including provisioning, deployment, scaling (up and down), networking, load balancing and more.
ECS and EKS both are container orchestration tools that manage the fleet of containers that are deployed on EC2 instances.
If the users want to deploy their code as containers but still don’t want to access the underlying environment then AWS Fargate is the best option.
AWS Fargate: AWS Fargate is a serverless compute engine for containers that work with both Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS).