Scalability and High Availability
Fleets
Show slides
EC2 Fleet and Spot Fleet are designed to be a useful way to launch a fleet—or group—of instances with AWS. Each instance in a fleet is based on a launch template.
Benefits:
-
Multiple instance types and purchase options: In a single API call, a fleet can launch multiple instance types and purchase options (Spot and On-Demand Instances).
-
Distributing instances across Availability Zones
-
Automated replacement of Spot Instances: If your fleet includes Spot Instances, it can automatically request replacement Spot capacity if your Spot Instances are interrupted or become impaired due to a change in instance health. Through Capacity Rebalancing, a fleet can also monitor and proactively replace your Spot Instances that are at an elevated risk of interruption.
As a general best practice, we recommend launching fleets of Spot and On-Demand Instances with Amazon EC2 Auto Scaling because it provides additional features you can use to manage your fleet:
-
automatic health check replacements for both Spot and On-Demand Instances
-
application-based health checks
-
an integration with Elastic Load Balancing to ensure an even distribution of application traffic to your healthy instances
You can also use Spot Fleet, but we don’t recommend that you do because it’s a legacy API with no planned investment.
Concepts
In a single API call, a fleet can launch multiple instance types across multiple Availability Zones, using the Spot Instance, On-Demand Instance, Reserved Instance, and Savings Plan purchasing options together.
You can specify:
-
Define separate Spot and On-Demand capacity targets and the maximum amount you’re willing to pay per hour.
-
Specify the instance types that work best for your applications.
-
Specify how Amazon EC2 should distribute your fleet capacity within each purchasing option.
-
A maximum amount per hour that you’re willing to pay for your fleet, and EC2 Fleet launches instances until it reaches the maximum amount. When the maximum amount you’re willing to pay is reached, the fleet stops launching instances even if it hasn’t met the target capacity.
Limitations
-
EC2 Fleet is available only through the Amazon EC2 API, AWS CLI, AWS SDKs, and AWS CloudFormation.
-
An EC2 Fleet request can’t span AWS Regions. You need to create a separate EC2 Fleet for each Region.
-
An EC2 Fleet request can’t span different subnets from the same Availability Zone.
Fleet request types
-
Instant: EC2 Fleet places a synchronous one-time request for your desired capacity. In the API response, it returns the instances that launched, along with errors for those instances that could not be launched.
-
Request: EC2 Fleet places an asynchronous one-time request for your desired capacity. Thereafter, if capacity is diminished because of Spot interruptions, the fleet does not attempt to replenish Spot Instances, nor does it submit requests in alternative Spot capacity pools if capacity is unavailable.
-
Maintain (Default): EC2 Fleet places an asynchronous request for your desired capacity, and maintains capacity by automatically replenishing any interrupted Spot Instances.