AWS provides various purchasing options for users to optimize their costs based on their needs. On-demand is the base option. You can pay just for what you use. But you can get a discount by reserving instances for a set of periods.
- Pay by the hour or the second (depending on the type of an instance)
- You can provision/terminate at any time.
- You are charged a fixed rate when the instance is running.
- No commitment and no up-front payment
- Most flexible but most expensive
Reserved Instance (RI)
- You can purchase an instance for a set time of periods (1 or 3 years) with huge discount
- 3 ways of payments: pay upfront, partial upfront, no upfront
- AZ-specific RIs provide capacity reservation.
- Regional RIs have no capacity reservation, but they are more flexible.
- Standard RIs: You cannot change instance types.
- Convertible RIs: They have the option to change to a different reserved instance type of equal or greater value.
Scheduled Reserved Instances (Scheduled Instances)
- You can purchase capacity reservations that recur on a daily, weekly, or monthly basis, with a specified start time and duration.
- Scheduled Instances are a good choice for workloads that do not run continuously but run on a regular schedule. For example, you can use Scheduled Instances for an application that runs during business hours or for batch processing that runs at the end of the week.
- You reserve the capacity in advance so that you know it is available when you need it. You pay for the time that the instances are scheduled, even if you do not use them.
- Spot instances are charged based on the AZ spot price (by the minute).
- Instance can be terminated with 2 minutes notice.
- Spot block: You may stop your spot instances from being terminated. (1 – 6 hours)
- Spot instances can be used for
- Applications that have flexible start and end times.
- Applications with urgent need of large amount of additions compute resources
- You can provision EC2 instances on physical servers dedicated for you.
- The type and size of the instance determine the number of instances in a dedicated host.
- Dedicated hosts can be used when there are regulatory requirements that may not support multi-tenant virtualization, such as some government projects. Or certain software might require hardware specifications.
- You are charged for the host instead of instances.
When to use
- On-Demand: default, short-term workloads that cannot tolerate interruption
- Reserved: Base/consistent load, known growth, predictable usage, critical systems
- Spot: Busty workload, cost-critical, can cope with interruption
- Spot fleets consist of a container of spot instances and optional on-demand instances.
- A spot fleet is used to launch the preconfigured instances to meet the target capacity needs with price restraints.