Table of Contents:
- What Is Elastic Beanstalk?
- What Is Fargate?
- Similarities Between Elastic Beanstalk and Fargate
- Differences Between Elastic Beanstalk and Fargate
- Elastic Beanstalk vs. Fargate: What to Use When
Deploying an application on the Amazon Web Services cloud can sometimes feel like eating at a restaurant with dozens of options on the menu: There are many ways to achieve your goals, and deciding which method is the best can be a struggle.
To provide some guidance, let's take a look at two of the most popular application deployment solutions that Amazon offers: AWS Elastic Beanstalk and AWS Fargate. As we'll see, both of these services streamline application deployment to the AWS cloud, but with different tradeoffs in terms of ease of use, control, and cost.
What Is Elastic Beanstalk?
Elastic Beanstalk is a cloud-based service that builds and deploys applications automatically. Users simply upload the code they want to run, configure a few deployment settings, and let Amazon complete the process for getting the application up and running.
Under the hood, applications deployed with Elastic Beanstalk are hosted on EC2 instances, but users don't have to configure or manage EC2 if they use Elastic Beanstalk. That work is automated by the service.
What Is Fargate?
Fargate is an automated deployment solution for containerized applications. With Fargate, users upload container images for the applications they want to run and configure how many CPU and memory resources to allocate to those applications. From there, Amazon deploys the applications automatically.
Like apps deployed with Elastic Beanstalk, Fargate-based applications run on EC2 instances. However, in the case of Fargate, the EC2 instances are pooled to create clusters of servers that are managed using either ECS (Amazon's homegrown container orchestration service) or EKS (Amazon's Kubernetes-based orchestrator).
Similarities Between Elastic Beanstalk and Fargate
At a high level, Elastic Beanstalk and Fargate are similar in that they both simplify the process of getting apps up and running in the cloud. Both services eliminate the need for cloud users to configure or manage the infrastructure that hosts their applications. Instead, they simply tell Amazon which applications they want to run, configure a few settings and let Amazon do the rest.
The services are also similar in that both rely on EC2 to provide the underlying host infrastructure for deployed applications, although the infrastructure is managed in somewhat different ways depending on whether you use Elastic Beanstalk (which runs applications directly on EC2 instances, without cluster orchestration) or Fargate (which runs applications on EC2-based server clusters managed by container orchestrators).
Differences Between Elastic Beanstalk and Fargate
When you look deeper, however, you find that Elastic Beanstalk and Fargate are distinct in many ways.
Application build process
One major difference is that Elastic Beanstalk builds your application for you. You just upload code, and Elastic Beanstalk does the rest.
With Fargate, however, you have to create a container image for your application first.
Supported platforms and languages
Elastic Beanstalk supports only certain application programming languages and deployment platforms. Fargate is more agnostic because it can run any type of application that can operate as a container — which means virtually any application that can run on Linux, regardless of the programming language.
Configuration options and control
Elastic Beanstalk and Fargate both provide various configuration options, but Fargate offers more. With Fargate, you can choose exactly which orchestration service hosts your application, configure advanced networking settings and much more. Elastic Beanstalk limits you mostly to configuring features like load balancing options and whether or not to use rolling deployments.
Comparing the cost of Elastic Beanstalk versus Fargate is complicated because each service uses a different pricing model. Elastic Beanstalk charges for the cost of the EC2 instances that you select for hosting your applications. In contrast, Fargate charges an hourly fee for each virtual CPU your application uses, as well as how much memory and storage it consumes.
In general, however, Elastic Beanstalk is likely to cost less than Fargate, especially if you choose low-cost EC2 instances for Elastic Beanstalk. For example, a t2.micro EC2 instance with one virtual CPU will cost $0.0116 per hour, which is a fraction of the $0.04048 you'd pay per hour for just the virtual CPU of a Fargate application.
Elastic Beanstalk vs. Fargate: What to Use When
So, when does it make sense to use Elastic Beanstalk and when should you opt for Fargate?
In general, Beanstalk is the best option if your priorities are simplicity and low cost — and if your application type is supported by Beanstalk, of course.
Meanwhile, Fargate is better if you want more control over how your application is hosted, your budget is not especially tight, and your application can be containerized.
About the authorChristopher Tozzi is a technology analyst with subject matter expertise in cloud computing, application development, open source software, virtualization, containers and more. He also lectures at a major university in the Albany, New York, area. His book, “For Fun and Profit: A History of the Free and Open Source Software Revolution,” was published by MIT Press.