An overview of AWS Spot Fleets (Collection of Spot Instances) Purchase Options.
Focus:
- Tailored for Devops, DevSecops & Cloud Engineers.
Breakdown:
- Intro,
- Key Features and How It Works,
- Best Use Cases,
- primary purchase options for instances within an AWS Spot Fleet request,
- Core Benefits,
- Key Config Options,
- Spot Fleet vs. EC2 Auto Scaling Group (ASG),
- Spot Fleet Use Cases,
- Spot Fleet Pricing Control,
- Spot Fleet Pricing Control,
- twtech insight.
Intro:
- An AWS Spot Fleet is a collection of AWS Spot Instances (and optionally On-Demand Instances) that are automatically managed to meet a target capacity at the lowest possible cost.
- Spot Instances leverage unused EC2 capacity and are available at up to a 90% discount compared to On-Demand prices but can be interrupted with a two-minute warning when AWS needs the capacity back.
- AWS Spot Fleets allow twtech to request a combination of Spot Instances, which are a purchase option for unused EC2 capacity, and optionally, On-Demand Instances and Reserved Instances.
- A Spot Fleet is a collection of Spot Instances (and optionally On-Demand Instances) managed together.
- twtech defines:
- Target capacity (in vCPUs, instances, or custom units)
- Multiple instance types and AZs (for flexibility)
- Max price you're willing to pay
- Allocation strategy (lowest price, capacity optimized, etc.)
- Then AWS figures out how to best fulfill the request across different instance types and Availability Zones to meet twtech target capacity at the lowest cost.
Automatic Management:
- The Spot Fleet manages the lifecycle of the instances, automatically provisioning new ones to maintain the specified target capacity, even if current instances are interrupted.
- The primary goal is cost savings.
- Users can specify a maximum price, and the fleet dynamically launches instances from available pools that meet the criteria.
- To minimize the risk of interruption, a fleet can be configured to use multiple instance types, Availability Zones, and purchase models (Spot and On-Demand).
- Users can select different allocation strategies, such as:lowest-price: Chooses instances from the spot pools with the lowest current price.
- capacity-optimized: Selects instances in pools that have the most available capacity to reduce the chance of interruption.
- Instance Weighting: twtech can assign "weights" to different instance types based on their performance (e.g., vCPUs), allowing the fleet to meet a target capacity based on aggregate "horsepower" rather than just the raw count of instances.
- The fleet can stop (rather than terminate) instances upon interruption if backed by EBS volumes, allowing them to resume when capacity is available.
- It also supports capacity rebalancing, launching a replacement instance before terminating the old one.
- Spot Fleets are best suited for flexible, stateless, or fault-tolerant applications that can handle unexpected interruptions:
- Big data workloads (e.g., Hadoop, Spark)
- Containerized applications
- CI/CD pipelines
- Web servers
- High-performance computing (HPC)
- AI/ML workloads that use checkpointing.
- Spot Fleets are generally not recommended for inflexible, stateful, or tightly coupled workloads that cannot tolerate individual instance interruptions.
Spot Instances:
- These are the core component of a Spot Fleet request.
- They allow twtech to bid for unused EC2 capacity and run those instances for as long as they are available.
- The price for a Spot Instance is set by AWS and adjusts gradually based on long-term supply and demand (bidding) for capacity, rather than an hourly auction.
- twtech can configure a Spot Fleet to include a base capacity of On-Demand Instances.
- These instances are launched at the standard On-Demand price and run continuously until twtech terminates them.
- While twtech cannot explicitly launch an RI within a Spot Fleet request itself, the capacity used by On-Demand instances requested by the fleet can be automatically covered by existing, unused RIs you own, helping to optimize twtech cost further .
- The Spot Fleet essentially utilizes the RIs that are already active in twtech account.
Core Benefits:
- Automatically diversifies across
instance types & AZs.
- Can combine Spot + On-Demand for
resilience.
- AWS manages rebalancing if Spot capacity
changes.
Key Config Options:
AllocationStrategy: Controls how AWS picks instances.lowestPrice(cheap but might get interrupted)capacityOptimized(less interruptions)priceCapacityOptimized(balance)TargetCapacityType: Units (instances, vCPUs, or custom)InstanceInterruptionBehavior: Decide what happens on termination (stop, hibernate, terminate)
Spot Fleet vs. EC2 Auto Scaling
Group (ASG)
| Feature |
Spot Fleet |
Auto Scaling
Group (Mixed Instances) |
|
Multi-instance flexibility |
✅
Yes (many types) |
✅
Yes |
|
AZ balancing |
✅
Yes |
✅
Yes |
|
Autoscaling |
❌
Manual scaling (unless integrated) |
✅
Native autoscaling |
|
More control |
✅
Fine-grained Spot strategies |
🔄
Less granular, but simpler management |
Spot
Fleet Use Cases
1. Batch Processing
- Big data (Hadoop, Spark, EMR)
- Scientific computing
- Media rendering or transcoding
2. CI/CD Pipelines
- Use Spot Fleets to run Jenkins/GitLab
runners or build jobs cheaply.
3. Stateless
Web App Backends
- Combine Spot + On-Demand in a fleet to
balance cost and availability.
4. Data Analytics / Machine Learning
- Training models or ETL jobs that can be
restarted or checkpointed.
5. Game Servers or Container Clusters
- Fleet to power ECS, EKS, or even game server
backend workers.
Spot Fleet Pricing Control
- Set
MaxTotalPriceto cap overall cost. - Use CloudWatch to monitor usage + cost.
A:
EC2 purchasing option for Spot
Instances.
- Biggest
Discount: Spot Instances can offer up to 90%
off compared to On-Demand prices.
- Not Suitable for Critical Jobs: AWS can terminate Spot Instances at any time if it needs the capacity back.
- So they are risky for critical workloads like production databases or critical apps that must always stay up.
B:
Use Security Groups to control traffic in and out of EC2 instances.
- Security
Groups act like virtual firewalls
at the instance level.
- They control inbound and outbound traffic based on rules twtech defines (like allowing SSH, HTTP),
C:
Reserve an EC2 Instance for one year or three years.
- 1-year
term: Lower commitment, still good savings.
- 3-year term: Bigger discount, better for long-term workloads.
D:
For High-Performance Computing (HPC) applications, use Compute-Optimized (C5/C6i/C7g) instances
- Hpc6id/Hpc7g:
Specifically designed for HPC workloads like
fluid dynamics, finite element analysis, etc.
- Compute-Optimized (C5/C6i/C7g): Great if twtech needs high CPU performance at a lower cost for HPC tasks.
E:
Use a Reserved Instance for an application its plans to run continuously
for 1 year.
- It gives twtech a big discount (up to 72% compared to
On-Demand pricing).
- Perfect for steady-state workloads where twtech know it'll need the server long-term.
F:
The
best way to handle EC2 User Data.
- User
Data lets twtech run scripts (like
installing software, updating OS packages) automatically
when a twtech-instance is launched for the first time.
- twtech can add shell scripts, cloud-init directives, or commands during instance setup.
G:
- For a critical application that uses an in-memory database, twtech uses a Memory-Optimized instance, specifically the R6i, R7i, or X2idn/X2iedn instance types.
- R6i/R7i:
Great for high-memory
workloads like Redis, Memcached, or similar.
- X2idn/X2iedn: Even larger memory and better price per GB if twtech needs massive in-memory databases.
H:
For
a high-frequency OLTP (Online Transaction Processing)
database with thousands of requests per second, use a Storage-Optimized
instance like I4i
if IOPS (input/output operations) are the
biggest bottleneck.
- I4i: Best if twtech needs very fast storage performance (NVMe SSDs) with extremely high IOPS for databases like SQL Server, Oracle, etc.
I:
A
Security Group can be attached to multiple
EC2 instances at the same time.
- This makes it easier to manage access rules across a group of instances together.
J:
The
best EC2 purchasing option for is Dedicated Hosts.
- Dedicated
Hosts give twtech physical servers
fully dedicated to use (not shared with other customers) — perfect
for strict compliance needs.
- This let twtech to use its own server-bound licenses (like Windows Server, SQL Server, Oracle) to save costs.
K:
The key difference between Dedicated
Hosts and Dedicated Instances lies in the level of control and
visibility they provide over the physical server:
Dedicated
Hosts: (dedicated to twtech)
- Physical server visibility: twtech gets full visibility into the underlying physical server.
- This is useful if twtech needs to meet specific compliance or
licensing requirements that depend on the physical cores and network
sockets.
- License management: twtech can bring its own server-bound licenses (e.g., Windows Server,
SQL Server, Oracle) and allocate them based on physical cores and sockets.
- More custom control: twtech can choose to place its instances on specific hosts and have full
control over the host's resources.
Dedicated
Instances:
- Isolation, no physical visibility: twtech instances run on hardware dedicated to twtecj,
but AWS manages the underlying physical hardware. twtech doesn't get visibility
into the physical server (e.g., cores, network sockets).
- No control over placement: Unlike Dedicated Hosts, twtech can't choose the exact physical server where its instances are launched.
- The underlying hardware
is still isolated, but it’s not as customizable.
twtech-Thoughts
- Dedicated Hosts:
Full visibility and control over the physical hardware, ideal for compliance
and licensing (custom contol).
- Dedicated Instances: Instances are physically isolated but twtech doesn't have control over the hardware
L:
The
best EC2 purchasing option is Dedicated Hosts.
- Dedicated
Hosts provide twtech with visibility into the physical
cores and underlying network socket
of the server.
- This option is ideal for applications where twtech needs to comply with vendor licensing based on physical hardware.
- This advantage allows twtech to track and allocate physical cores and sockets for licensing purposes.
M:
Spot
Fleet is a set (collection) of Spot Instances and
optionally On-Demand Instances.
- Spot
Fleet allows twtech to request a combination of Spot Instances
and On-Demand Instances to meet specific
application requirements (like availability and cost balance).
- The
fleet automatically adjusts the number of instances to maintain the target
capacity.
No comments:
Post a Comment