Amazon EC2 allows you to bid for and run spare EC2 capacity, known as Spot instances, in a dynamically priced market. On average, customers save 80% to 90% compared to On Demand prices by using Spot instances. Achieving these savings has historically required time and effort to find the best deals while managing compute capacity as supply and demand fluctuate.
In this session, we dive into how customers who have designed scalable, cloud friendly application architectures can leverage new Spot features to realize immediate cost savings while maintaining availability. Attendees will leave with practical knowledge of how, via well architected applications, they can run production services on the Spot instances just like IFTTT and Mapbox.
2. On-Demand
Pay for compute
capacity by the hour
with no long-term
commitments
For spiky workloads,
or to define needs
Amazon EC2 Consumption Models
Reserved
Make a low, one-time
payment and receive
a significant discount
on the hourly charge
For committed
utilization
Spot
Bid for unused
capacity, charged at a
Spot Price which
fluctuates based on
supply and demand
For time-insensitive
or transient
workloads
3. With Spot ,the rules are simple
Markets where the price of
compute changes based on
supply and demand.
You’ll never pay more than your
bid. When the market exceeds
your bid, you get 2 minutes to
wrap up your work.
4. $0.27 $0.29$0.50
1b 1c1a
8XL
$0.30 $0.16$0.214XL
$0.07 $0.08$0.082XL
$0.05 $0.04$0.04XL
$0.01 $0.04$0.01L
C3
$1.76
On
Demand
$0.88
$0.44
$.22
$0.11
Show me the markets!
Each instance family
Each instance size
Each Availability Zone
In every region
Is a separate Spot Market
25. Best Practices
• Diversify across Availability Zones, regions, and the types of
instances you use to ensure stability
• Reduce your cold start time
• Break up large jobs into smaller pieces
26. Diversify for stability
• 10 completely isolated regions, multiple Availability Zones, and
multiple instance types
• The Spot market is segmented by these dimensions, so each one
adds an additional layer of protection against price spikes and
interruptions
• Use Spot Fleet: bid on multiple types of instances
• ECS makes it easy to deploy applications across multiple types of
instances
27. Spotswap
• Manages Spot priceouts for a Spot Fleet by activating backup On-
Demand capacity.
• Polls the termination notification endpoint on each instance and tags
instances that are about to be terminated
• When enough Spot Instances are about to be terminated, we
automatically launch On-Demand instances to pick up the slack
• When Spot prices go back down, we shut down the more expensive
On-Demand instances
28.
29. Reduce your cold start time
• Bake software into an AMI or Docker image for fast loading
• Minimize state on the EC2 using S3, DynamoDB, or Amazon Kinesis
• Goal should be to have your application bootstrap in less than 2
minutes
• ECS helps us quickly deploy applications and move them around to
different EC2 instances - seconds instead of minutes
33. And finish it faster
Instance 1
Instance 2
Instance 3
5 hours
Use the same number of compute hours, but how many EC2
instances you run decides how quickly the work gets done.
35. Example: how to break up a text file
• Take a text file with 10 million lines
• Divide number of lines by 10000
• Generate a SQS message for each
chunk of 10000 lines (1000
messages)
• Have your workers start reading at
the specified point in the file
• Deliver output to S3
36. Impact
• Spot interruptions are relatively rare for the instance types we use,
so the fallback is only triggered a 1-2 times per month.
• We are running on discounted Spot Instances more than 98% of the
time.
• On our maps service alone, this has resulted in an 90% savings on
our EC2 costs each month.
37. $$$ Gotchas
Spot enables you to run many more instances that you
normally would, so watch out for any small costs that add
up
Detailed monitoring at 1-minute granularity costs about
$0.005 per hour, but if you do 2 million hours, it adds up to
almost $10K
EBS volumes are still full price on Spot so use instance
store
38. Amazon EC2 Spot – in the wild
1) We make this easy, using
the Spot Bid Advisor.
2) With deliberate pool
selection and bidding, you
keep your Spot Instance as
long as you need to.
3) And with new features like
Spot Fleet diversified, we do
the heavy lifting for you...
40. Spot Fleet helps you
Launch Thousands of Spot Instances
with one RequestSpotFleet call.
Get Best Price
Find the lowest priced horsepower that works for you.
or
Get Diversified Resources
Diversify your fleet. Grow your availability.
And
Apply Custom Weighting
Create your own capacity unit based on your application
needs
42. An easy to use interface that
lets you launch spare EC2
instances in seconds
Helps you select and bid on the
EC2 instances that meet your
applications requirements
Simple to use dashboard lets
you modify and manage your
application’s compute capacity
EC2 Spot Console
45. Diversification with EC2 Spot Fleet
Multiple EC2 Spot instances
selected
Multiple Availability Zones
selected
Pick the instances with similar
performance characteristics, e.g.
c3.large, m3.large, m4.large,
r3.large, c4.large
50. IFTTT Infrastructure 2014
• Experimenting with Spot bidding for workers
• Spot Auto Scaling groups with fixed bid prices
• Started to depend on Spot capacity
• ~50% savings over On-Demand
• Approach vulnerable to market fluctuations
52. IFTTT on Spot Fleet
• Launch worker AMI via Spot Fleet into a mix of markets
• AMI configured to scale based on instance type
• Moved all workers over to Spot Fleet management
55. IFTTT Infrastructure Now
• All applications in Docker containers
• Containers scheduled by Mesos and Marathon
• Heterogenous (web containers alongside worker, etc.)
56. IFTTT Infrastructure Today
• Reserved instances for Zookeeper & leaders
• Cluster managed entirely by Spot Fleet
• Initially in 48 different Availability Zones
• Mesos instance AMI auto-boots and connects to cluster
• Mesos nodes advertise available resources
57. IFTTT Instance Weights
• Looked at memory and CPU usage across cluster
• Calculated max containers per instance type
• Set instance weights to relative calculations
• Allocation metrics reported to CloudWatch
58. IFTTT Results
• Estimated cost of 75% less than On-Demand
• Bin-packing adds extra savings over previous system
• Spot Fleet manages capacity automatically
• Infrastructure abstraction frees up developers