EC2 Spot Instances
Overview
- Cost Savings: Up to 90% discount compared to On-Demand pricing.
- Max Spot Price: Users define the maximum price they are willing to pay.
- Price Variation: Spot price varies based on supply and demand.
- Termination Options: If the spot price exceeds the user's max price, the instance can be stopped or terminated.
- Grace Period: Users have a two-minute grace period to decide upon receiving a termination notice.
Spot Instance Strategies
- Spot Blocks: Reserve a spot instance for 1 to 6 hours to prevent AWS from reclaiming it.
- Use Cases: Suitable for batch jobs, data analysis, and workloads resilient to failures. Not recommended for critical jobs or databases.
Spot Instance Pricing
- Price Fluctuations: Spot prices vary by Availability Zone (AZ).
- Example: An m4.large instance price over three months in us-east-1 region.
- Cost Optimization: Users can set a max price and only pay for the spot instance when it's below this threshold.
- Savings: Significant savings compared to On-Demand pricing.
Terminating Spot Instances
- Spot Requests: Define instance count, max price, launch specifications, and request type.
- Request Types:
- One-Time Request: The request is fulfilled and then goes away.
- Persistent Request: The request remains active and instances can be relaunched if stopped.
- Cancellation: Cancel the spot request first, then terminate the associated instances to prevent automatic relaunching.
Spot Fleets