Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News AWS EC2 Fleet: Manage Thousands of On-Demand and Spot Instances with One Request

AWS EC2 Fleet: Manage Thousands of On-Demand and Spot Instances with One Request

This item in japanese


Amazon have announced EC2 Fleet, a new feature that extends the existing Spot Fleets, which gives customers a unique ability to create fleets of EC2 instances composed of a combination of EC2 On-Demand, Reserved, and Spot Instances, by using a single API. A customer can specify what capacity and instance type VM's they require, and AWS will launch, manage, monitor and scale instances that they need, without the need to write any scaffolding code.

In the past, customers could create thousands of Spot instances of varying instance types with a single request by using an API that allows them to launch and manage an entire fleet of Spot Instances. This allows a customer to easily balance desired scale, performance and cost, without the need to write complicated glue code to manage multiple API calls. Now, they can create a fleet with a combination of various EC2 instances and start them with a single request. The customer specifies the capacity of the fleet regarding the number of instances, virtual CPU’s (vCPUs) or application units (the relative power of each EC2 instance type in a way that directly maps to the needs of your application). These specifications are called weights. 

With EC2 Fleet, customers can push their workloads to their instances to process them for the lowest possible price. By creating a template that contains several settings, including InstanceType, WeightedCapacity, and TargetCapacitySpecification containing the TotalTargetCapacity, OnDemandTargetCapacity, SpotTargetCapacity, and DefaultTargetCapacityType values, a customer can describe their fleet, taking advantage of the use of Spot Instances (the unused capacity within AWS, and the cheapest available VM’s within AWS EC2) to fulfills their needs.

"LaunchTemplateConfigs": [
            "LaunchTemplateSpecification": {
                "LaunchTemplateId": "lt-0e8c754339b27161c",
                "Version": "1"
        "Overrides": [
          "InstanceType": "m4.16xlarge",
          "WeightedCapacity": 64,
          "InstanceType": "m5.24xlarge",
          "WeightedCapacity": 96,
    "TargetCapacitySpecification": {
        "TotalTargetCapacity": 2880,
        "OnDemandTargetCapacity": 960,
        "SpotTargetCapacity": 1920,
        "DefaultTargetCapacityType": "Spot"

EC2 Fleet will use the fleet description file to create the fleet using the specified number of, for instance, m5.24xlarge On-Demand Instances and m4.16xlarge Spot Instances. A customer can trigger the creation of the fleet by executing a single command using AWS CLI or an API call.

$ aws ec2 create-fleet --cli-input-json file://home/ec2-user/fl1.json

The EC2 Fleet will select the most cost-effective combination of instance types and Availability Zones using the current prices for the Spot Instances and the public prices for the On-Demand Instances. For pricing details see Amazon EC2 pricing.

In the default mode, the weights are taken into account to acquire the lowest cost per weighted unit. Furthermore, if customers have specified instance for which they have matching Reserved Instances (RIs), then their discounts will apply.  Based on current Spot prices per vCPU, the EC2 Fleet will launch the appropriate number of instances to deliver the specified number of SpotTargetCapcity. Also, when spot instances capacity is no longer needed the customer can change the target capacity to a newly required capacity leveraging only On-Demand instances. When the fleet is no longer necessary, the customer can delete and terminate the instances with another single command.

$ aws ec2 delete-fleets --fleet-id fleet-838cf4e5-fded-4f68-acb5-8c47ee1b248a \

Amazon is planning to integrate EC2 Fleet with EC Auto Scaling groups to allow the customer to create a single fleet consisting of a mix of instance types, while taking advantage of EC2 Auto Scaling features such as health checks and lifecycle hooks. Furthermore, Amazon will bring this EC2 functionality to services like Amazon ECS, Amazon EKS, and AWS Batch that builds on and makes use of EC2 Auto Scaling for fleet management. The current EC2 Fleet is available in all public AWS regions.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p