Table of contents
Compute services are a set of cloud-based offerings for deploying, managing, and scaling applications and services.
AWS comes with a large range of these. Each of them has its own advantages and limitations. In this article, you'll learn the fundamentals so you know your options for different requirements.
Introduction to AWS Compute Services
When we’re building applications on AWS, we need to run our code somewhere: a compute service. There are several well-known and mature services that you can choose from. Let’s go through a little history of how computing evolved over the past years.
From Bare Metal Running on-Premise, over Virtual Machines to Function-As-A-Service
On-premise servers are physical machines owned and operated by an organization and typically located in a dedicated data center. These servers require significant up-front investments, as well as ongoing maintenance and management.
With the advent of cloud computing, it’s now possible to rent virtual machines, such as with EC2. This allows scaling compute resources up and down as needed, not requiring significant up-front investments. However, this virtualization still requires management and maintenance by its users, like operating system updates or security patching.
The next abstraction came with containers. Containers allow the bundling of an application and all its dependencies into a single package that can be easily moved between environments. This allows for a much more efficient use of resources, and better isolation between different applications. Containers don't require a host operating system, just a container engine like Docker. For managing multiple containers, services like ECS were developed. It takes over the orchestration of containers to users don’t have to take on the burdens of running, stopping, and managing clusters of containers.
The latest development in computing is Functions-as-a-Service, like Lambda. With Lambda, you can execute code without provisioning or managing any infrastructure. This approach is known as "serverless" computing, because the cloud provider handles all of the underlying infrastructure, scaling, and management, allowing developers to focus solely on writing and deploying code.
The Core Compute Services
AWS offers a large suite of mature, battle-tested compute services for deploying, managing, and scaling applications. Among these, EC2, Fargate, and Lambda are considered the core service offerings. They can be used for basically any workload.
EC2 - Launching Virtual Machines for Any Workload
Amazon EC2 (Amazon Elastic Compute Cloud) is a web service that provides resizable computing capacity in the cloud.
It is designed to make web-scale cloud computing easier for developers and is one of the first services launched by AWS back in 2006. With EC2, you can rent virtual machines to run your own applications. This allows you to scale your application's capacity up or down as needed, making it a cost-effective solution for businesses. EC2 provides various instance types to suit workloads, including memory-optimized instances, compute-optimized instances, and GPU support. Generally speaking, EC2 comes in more than 500 variations which are perfectly designed for every specific need.
Flexibility - EC2 comes with hardware for any workload requirements.
Scalability - Instances can be scaled up and down horizontally and vertically.
Cost-effectiveness: EC2 instances can be started and stopped on-demand, so you're only paying for the compute capacity you actually need.
Management Overhead - EC2 requires you to manage the operating system, install security patches, and other software updates.
Complexity - Setting up and operating EC2 instances is rather complex for inexperienced users in comparison to more abstracted services like ECS with Fargate or Lambda.
Pricing - As you're paying for the time that an instance is up and running, you could be paying for idling servers.
Fargate via ECS - Running and Orchestrating Containers
Amazon Elastic Container Service (ECS) is a highly scalable and fast container management service. It offers a management plane to orchestrate containers of your cluster. Simply run, stop & manage containers.
AWS Fargate is the serverless compute engine that's underneath ECS and that is used to execute the workloads. It comes along with many features to ease your development process and reduce operations and liabilities. This includes high scalability, cost efficiency, and the use of use.
- Fewer Operations - Containers can automatically be scaled based on traffic requirements. You don't need to worry about the underlying operating system or security patches, only about your container image.
Increased Security - Fargate isolates containers, reducing the risk of security vulnerabilities and performance issues due to noisy neighbors.
Cost-effectiveness: Fargate containers can be very quickly started and stopped based on your auto-scaling rules.
Limited Flexibility: Fargate is not as flexible as EC2. Not only based on the fact that it only supports containers but also regarding the hardware specs that are supported.
Less Control - Fargate has a higher abstraction layer than EC2, which not only removes liabilities but also some controls.
Pricing - Fargate is more cost-effective than EC2, but is still charged when containers are up and running. In comparison to Lambda, this can be rather expensive for early-stage applications.
Lambda - Run Code without Worrying about Infrastructure
Container orchestration services like ECS allow you to easily run containers and don't think much about the underlying management of how they are executed.
With AWS Lambda, launched back in 2014, AWS took this one step further by completely removing customers' liability for the underlying infrastructure. The only thing that is necessary is the code that needs to be executed. AWS will take care of provisioning and maintaining the underlying infrastructure to run it.
High Abstraction - You're not responsible for any underlying infrastructure.
Pay-as-you-go - Lambda is only charged for the time when a function is executed. You will never be billed for unused computing resources.
Instant Scaling - Lambda automatically scales applications in milliseconds in response to changes in demand.
Very Limited Resource Control - Due to its high abstraction, you're giving up control of anything that's beneath your application code.
Cold Starts - Applications running on Lambda may experience latency during cold starts, which can impact performance.
Resource Constraints - Lambda is very restricted with its maximum compute resources for single instances compared to Fargate or EC2. Due to its capability of running workloads at very high concurrency, this doesn't have to be a major downside.
More, but Less Prominent Compute Services
EC2, Fargate, and Lambda are the most used and known computing services by AWS. But it doesn't end here. AWS offers way more than that.
App Runner - Deploying Containerized Applications without Any Prior Infrastructure or Container Experience
ECS with Fargate is a great abstraction to more traditional, virtual machine-based services like EC2. Nevertheless, it does require fundamental networking knowledge and some prior infrastructure experience.
AWS App Runner, also a fully-managed service, increases the abstraction level to get over those requirements. Instead of the necessary network configuration to set up your workload execution environment, App Runner only requires you to specify a container image that you want to run.
App Runner will then take care of automatically building and deploying your application. It will handle load balancing, traffic encryption, and automatically scaling your infrastructure up and down based on traffic requirements.
It's a rather new service that is not as mature as orchestration services like ECS with Fargate or Function-as-a-Service offerings like Lambda.
Elastic Beanstalk - Deploy and Run Any Web Application with High Abstraction
AWS Elastic Beanstalk is another fully managed service that helps to deploy, run, and scale web applications. It supports applications and services in all modern and traditional languages like Java, .NET, PHP, Node.js, Python, Ruby, or Go.
You don't need to think much about the underlying infrastructure, as Beanstalk will take care of capacity-based provisioning, deployment, load balancing, and scaling.
Lightsail - A Simplified Compute Services and an Easy-To-Use Interface for Launching and Managing Instances
Amazon LightSail is a computing service that strictly focused on ease of use. It's the easiest service to launch and run a private server for any workload or application. It includes features like SSD-based storage and a static IP and comes with low, predictable pricing.
It's a great option to get an application up and running fast, but due to its simplicity and abstraction, it's less customizable than many other services.
Services to Cover Very Specific Requirements
We've gone through many computing services that can be used for any workload. But that's not all. AWS offers more services that focus on rather dedicated use cases, including AWS Batch, AWS Outposts, and AWS Wavelength.
Batch - Running Highly Parallelized Batch Computing Jobs
AWS Batch is a service that is designed to run small, large, or gigantic processing workloads. Due to its very high scalability, it allows you to run thousands of batch computing jobs in the cloud without worrying about the necessary underlying infrastructure.
AWS will take care of provisioning the optimal type and quantity of resources based on the job requirements. It will simply plan, schedule, and run your workloads and you can still take advantage of reduced pricing offers via features like Spot Instances.
Outposts - AWS-Managed Infrastructure on-Premise for a Hybrid Cloud
With AWS Outposts you can run your workloads in any on-premise location without giving up on the AWS developer experience. It also allows you to natively connect to other local AWS services that are offered within the AWS region.
This solution is the perfect fit if you want to or need to run workloads on-premise due to on-site speed or compliance requirements, but still not miss out on the cloud benefits offered by AWS.
Wavelength - Running Compute Services on the Edge of Modern Telecommunication Networks
AWS Wavelength is maybe the most exotic of the compute service offerings by AWS. It's an offering that focuses on smartphones and Internet of things devices, anything that's connected via the latest telecommunication standards like 5G.
Wavelength zones are AWS-deployed infrastructures within the telecommunication network. This means requests from mobile devices do not need to be routed via multiple hops through the internet. They can reach servers from AWS without leaving the telecommunications network.
This results in the fact that customers can take advantage of low latency and the full bandwidth that's offered by modern networks.
AWS offers a range of computing services for any requirement. Each of them comes with its own benefits and limitations.
There are three popular services that are widely used: EC2, Fargate, and Lambda. With EC2, you'll get virtual machines in a wide range of hardware configurations and a rather low abstraction. With Fargate, you can simply run containers via ECS' orchestration panel without thinking much of underlying hardware. With Lambda, you only bring your code and AWS will take care of how it's actually executed.
Besides those well-known services, AWS comes with other fully-managed, highly-abstracted services to run applications. This includes App Runner, Elastic Beanstalk, and LightSail.
Last but not least, AWS Batch, Outposts, and Wavelength are there to cover very specific requirements.