AWS Knowledge

AWS Spot Fleet Cost Saving Strategies Explained

Piyush Kalra

Dec 20, 2024

    Table of contents will appear here.
    Table of contents will appear here.
    Table of contents will appear here.

AWS Spot Fleet has proven to be one of the greatest assets for engineers, architects, and developers to maintain cost efficiency while ensuring both scalability and flexibility. This is applicable when dealing with stateless applications, a machine learning model, and even rendering CGI for movies. Instead of ranging from Rendering for sea studios to creative applications, companies can achieve up to 90% savings compared to On-Demand instances with AWS Spot Instances and Spot Fleet.

But how do these Spot Fleets actually work, and what strategies should you adopt so that you can end up saving more while still charging a fee for ensuring a certain level of performance? This article’s primary intent is to better understand AWS Spot Fleet, their function, spot pricing models, and ways to finance their operation.

What is AWS Spot Fleet?


A Spot Fleet is a combination of spot Instances and any other resources on AWS that have been put into a single entity. This feature allows you to manage workloads efficiently while fully utilizing the available EC2 capacity and other services at extremely low cost. Spot Fleets use the compromised EC2 resources provided by AWS at a lower rate in conjunction with previously mentioned AWS compute services when a business workflow can handle interruptions.

A single request allows you to start and control thousands of Spot, On-Demand, and other types of Interactions over a huge number of zones or availability zones and Instance types.

How Spot Instances Work and Their Pricing Model

Spot Instances, like the term “Spot,” allow users to pay according to their preferences. AWS pays them whenever the spot price goes below the load that the user specified in the instance. While they handle large loads, Spot Instances post the drawback that AWS can take back the instance with two minutes' notice if they require the capacity elsewhere.

The lack of effective functioning, integration of databases, and the need to manage workloads make Spot Instances the best algorithms in stateless or fault-tolerant applications.

Submitting a Spot Fleet request forms the core of creating a Spot Fleet at scale. In this process, you specify:

  • Required capacity (the number of instances that you want)

  • The desired ratio of Spot and On-Demand Instances

  • Launch specifications, such as instance type, AMI, availability zone, and security groups 

There are two types of Spot Fleet requests:

  1. Request Type: Creates a one-time Spot Fleet. 

  2. Maintain: Replaces any lost or repossessed instances to help maintain the required capacity level.

When determining the composition of a Spot Fleet, better decision-making is necessary. Users must define what requirements or specifications the application will hold and quantify the amount of On-Demand Instances that will be kept available to maintain reliability.

Comparison with On-Demand and Reserved Instances

Benefits of Using AWS Spot Fleets

Significant Cost Savings

One of the most notable characteristics of Spot Fleets is the cost reduction. With assistance from unused EC2 capacity, organizations can realize expenses up to 90% less; this can easily lead to thousands or even millions of dollars calculated based on reduced compute costs.

For example, the National Football League spends around $2 million in a season while employing over 4,000 Spot Instances for high intenzity scheduling tasks that need to be performed.

Flexibility for Various Workloads

Spot Fleets are ideal for workloads such as:

  • Big data and analytics

  • Machine learning training models

  • CI/CD pipelines

  • Video encoding and rendering

  • Web services that can recover from interruptions

Integration with AWS Services

Other AWS services that are easily integrated with Spot Fleets include:

  • Amazon EC2 Auto Scaling Groups for ensuring that the minimum target capacity is reached.

  • AWS Elastic MapReduce is used to process big data.

  • AWS ECS and AWS Batch for containerized workloads.

Understanding Cost Dynamics

Spot prices range in respect to the demand and availability of the Spot instance pools aimed at a specific target. Each pool consists of available instances of the same type encapsulated in an availability zone. Relatively, the prices are higher than on-demand but can change depending on the minute.

Example: Assume you are operating a web application and require a t3.large instance located in US-East-1. When there are a lot of unused t3.large instances in the region, the Spot Price will be lower. But if the demand rises or the availability gets affected, then the instance price goes up, and your instance could also be interrupted.

Factors Influencing Spot Prices

There are certain factors which affect our Spot Pricing:

  • Availability of unused capacity: The more unused servers are in a zone, the lesser the Spot Prices will be. For example, if a surplus of r5.xlarge instances exists in a particular zone, the prices for this type will lower.

  • Current demand in specific regions or Availability Zones: The availability of a region and the current demand dictate the spot prices. For example, if there is a sudden increase in demand in a region (e.g. a large firm runs a campaign requiring numerous m5.large instances), that region would have its Spot Prices increased due to the increase in demand.

  • Instance type and size: Smaller instance types, which are more frequently used t2.micro, are likely to have greater price variation than larger and less frequently used types tend to have a steady price (e.g. p4d.24xlarge).

When there is an interruption in your workflow, it is best to use Spot Instances on batch jobs such as bulk data processing or video data uploading. For example, let's say if you want to cut down on expenses while having the job done, you can use Spot Instances to upload videos during the night.

Importance of Monitoring Historical Spot Prices

Nowadays, it is almost impossible to forecast the direction in which AWS Spot prices will take. However, knowing the historical spot prices can help to make reasonable guesses on when and where to apply for spot instance. In order to do this, AWS offers some utilities, such as the Spot Price History API and AWS Cost Explorer.

Best Practices for Optimizing AWS Spot Fleet Usage

Diversify Instance Types

To mitigate the chances of service interruption, deploy a combination of different instance types, zones, and sizes. Spreading your Spot Fleet requests broadens the number of Spot capacity pools from which you can draw and subsequently enhances your application’s reliability.

Example: If you only employ t3.medium instances in us-east-1a, extend your fleet to incorporate t2.medium or t3a.medium in us-east-1b.

Set Price-Capacity-Optimized Allocation Strategies

Amazon introduced the price-capacity-optimized allocation in 2022 approach focusing on the Spot pools that are least likely to be interrupted. This way, you have ensured that the instances selected are from well-stocked and relatively cheap pools. For example, in order to use low-cost instances, if you need to, then you can limit the workloads on a particular type of instance to help reduce the frequency of interruption by spreading them across various types and different Spot pools, or you can employ Auto Scaling which will automatically replace interrupted instances. Furthermore, in offsetting cost against reliability, combining the use of On-Demand or Reserved Instances with Spot Instances can also help.

Use Auto Scaling Groups

Integrate Spot Fleet with Auto Scaling Groups to maintain a particular level of your application's accessibility while also maintaining efficiency for resource use. Whenever a Spot is in demand, Auto Scaling will perform horizontal scaling; on the other hand, if it is not used, the auto-scaling will turn off.

Spot Fleet provides three auto-scaling techniques that are robust and useful:

  • Target Tracking Scaling: This automated function ensures that the target metric, like CPU utilization, is maintained below 80%.

  • Step Scaling: Using CloudWatch allows the capacity to be incremented when it has been triggered by an alarm resource.

  • Scheduled Scaling: This allows the increase and decrease of capacity on the date and time that has been pre-defined by the user.

Managing Interruptions Effectively

Capacity Rebalancing

Make rebalancing a proactive activity by moving the workloads before an interruption occurs. AWS suggests that users enable Capacity Rebalancing, which replaces Spot Instances that are in compromised positions.

Predictive Rebalancing

Utilize forecasting capabilities to estimate Spot Instance interruption and modify resource usage features as needed. AWS Fault Injection Simulator is useful in carrying out stress tests and enhancing the application's resilience.

Combining On-Demand and Reserved Instances

When working with Spot Fleet, pairing these with On Demand and Reserved instances will offer you a consistent level of application performance at all times, even though Spot Fleet might be less expensive.

Example Use Case: For a video streaming application, Spot instances can be deployed for the encoding processes that are run in batches, On-demand instances for the live streaming services and reserved instances for the operations that involve the database and are to be done when the application is idle.

How To Create Spot Fleet Through AWS Console Step By Step

  1. Open the Amazon EC2 Console and select "Spot Requests."


  1. Click "Request Spot Instances."


  1. Under Launch parameters, choose “Manually configure launch parameters.”


  1. Select the AMI you need and configure instance types.


  1. Scroll down, and specify your total target capacity and desired allocation strategy.


  1. Review your fleet configuration, and choose Launch.

Tips for Configuring Launch Parameters

  • Use attribute-based instance type selection to search for the appropriate instances automatically.

  • Set budget limits to help avoid mistaken overspending.

Monitoring and Managing Spot Fleet Costs

  1. Use AWS Cost Explorer: AWS Cost Explorer shows the history of utilization of the Spot Fleet service and its costs, which allows you to control costs and find places where there are cost savings.

  2. Enable Resource Tagging: Tag Spot Instances and volumes for better visibility and cost management.

Conclusion

AWS Spot Fleets are the best solution for companies willing to save a considerable amount of money without sacrificing flexibility and scalability. If you apply these recommendations and make appropriate use of AWS tools, your company will be able to use Spot Fleets for inexpensive yet powerful cloud computing readily.

So why not try Spot Fleets and see how they can work for you?

Join Pump for Free

If you found this post interesting, consider checking out Pump, which can save you up to 60% off AWS for early-stage startups, and it’s completely free (yes, that's right!). Pump has tailor-made solutions to take you in control of your AWS and GCP spend in an effective way. So, are you ready to take charge of cloud expenses and maximize the most from your investment in AWS? Learn more here.

Similar Blog Post

1390 Market Street, San Francisco, CA 94102

Made with

in San Francisco, CA

© All rights reserved. Pump Billing, Inc.

1390 Market Street, San Francisco, CA 94102

Made with

in San Francisco, CA

© All rights reserved. Pump Billing, Inc.

1390 Market Street, San Francisco, CA 94102

Made with

in San Francisco, CA

© All rights reserved. Pump Billing, Inc.