Choosing the Amazon EC2 instance type - Amazon Elastic Container Service

Choosing the Amazon EC2 instance type

If you use Amazon EC2 to provide capacity for your ECS cluster, you can choose from a large selection of instance types. All Amazon EC2 instance types and families are compatible with ECS.

To determine which instance types you can use, start by eliminating the instance types or instance families that don't meet the specific requirements of your application. For example, if your application requires a GPU, you can exclude any instance types that don't have a GPU. However, you should also consider other requirements, too. For example, consider the CPU architecture, network throughput, and if instance storage is a requirement. Next, examine the amount of CPU and memory provided by each instance type. As a general rule, the CPU and memory must be large enough to hold at least one replica of the task that you want to run.

You can choose from the instance types that are compatible with your application. With larger instances, you can launch more tasks at the same time. And, with smaller instances, you can scale out in a more fine-grained way to save costs. You don't need to choose a single Amazon EC2 instance type that to fit all the applications in your cluster. Instead, you can create multiple Auto Scaling Groups,. Each group can have a different instance type. Then, you can create an Amazon EC2 Capacity Provider for each one of these groups. Last, in the Capacity Provider strategy of your service and task, you can select the Capacity Provider that best suits its needs.