Amazon ECS launch types
The task definition launch type defines what capacity the task can run on, for example AWS Fargate.
After you choose the launch type, Amazon ECS verifies that the task definition parameters you configure work with the launch type.
Fargate
Fargate is a serverless, pay-as-you-go compute engine that lets you focus on building applications without managing servers. When you choose Fargate, you don't need to manage an EC2 infrastructure. All you need to do is build your container image and define which cluster you want to run your applications on. Fargate has native integration with AWS services including:
-
Amazon VPC
-
Auto Scaling
-
Elastic Load Balancing
-
IAM
-
Secrets Manager
You have more control with Fargate than EC2 because you select the exact CPU and memory that your application needs. Fargate handles scaling out your capacity, so you don't need to worry about spikes in traffic. This means that there is less operational effort with Fargate.
Fargate meets the standards for compliance programs including PCI, FIPS 140-2,
FedRAMP, and HIPAA. For more information see AWS Services in Scope by Compliance Program
Fargate is suitable for the following workloads:
-
Large workloads that require low operational overhead
-
Small workloads that have occasional burst
-
Tiny workloads
-
Batch workloads
For information about the Regions that support Fargate, see Supported Regions for Amazon ECS on AWS Fargate.
The following diagram shows the general architecture.
For more information about Amazon ECS on Fargate, see AWS Fargate for Amazon ECS.
EC2
The EC2 launch type is suitable for large workloads that must be price optimized.
When considering how to model task definitions and services using the EC2 launch type, we recommend that you consider what processes must run together and how you might go about scaling each component.
As an example, suppose that an application consists of the following components:
-
A frontend service that displays information on a webpage
-
A backend service that provides APIs for the frontend service
-
A data store
For this example, create task definitions that group the containers that are used for a common purpose together. Separate the different components into multiple and separate task definitions. The following example cluster has three container instances that are running three front-end service containers, two backend service containers, and one data store service container.
You can group related containers in a task definition, such as linked containers that must be run together. For example, add a log streaming container to your front-end service and include it in the same task definition.
After you have your task definitions, you can create services from them to maintain the availability of your desired tasks. For more information, see Creating an Amazon ECS service using the console. In your services, you can associate containers with Elastic Load Balancing load balancers. For more information, see Use load balancing to distribute Amazon ECS service traffic. When your application requirements change, you can update your services to scale the number of desired tasks up or down. Or, you can update your services to deploy newer versions of the containers in your tasks. For more information, see Updating an Amazon ECS service using the console.
External (Amazon ECS Anywhere)
Amazon ECS Anywhere provides support for registering an external
instance such as an on-premises server or virtual machine (VM), to your
Amazon ECS cluster. External instances are optimized for running applications that generate
outbound traffic or process data. If your application requires inbound traffic, the lack
of Elastic Load Balancing support makes running these workloads less efficient. Amazon ECS added a new
EXTERNAL
launch type that you can use to create services or run tasks
on your external instances.
The following provides a high-level system architecture overview of Amazon ECS Anywhere. Your on-premises server has both the Amazon ECS agent and the SSM agent installed.
For more information, see Amazon ECS clusters for the external launch type.