以 Amazon EC2 Spot 執行個體有效控制專案成本 (Level: 200)
- 1. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ryder Wang
Territory Business Development Manager
以 Amazon EC2 Spot 執行個體
有效控制專案成本
- 2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
•Amazon EC2 Spot recap
•Overview of new EC2 Spot features (2017
Q3 & Q4 - Now)
- 3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
•Amazon EC2 Spot recap
•Overview of new EC2 Spot features (2017
Q3 & Q4 - Now)
- 4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS compute offerings
VM Task Function
Service EC2 Lambda
H/W OS Runtime
Unit of scale
Level of
abstraction
ECS / EKS / Fargate
- 5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
On-Demand
Pay for compute capacity by
the second or hour with no
long-term commitments
For spiky workloads,
or apps being developed or
tested on EC2 for the first
time
AWS EC2 Consumption Models
Reserved
Reserved Instances provide you
with a significant discount
compared to On-Demand
instance pricing.
For applications that have steady
state or predictable usage,
Reserved Instances can provide
significant savings compared to
using On-Demand instances.
Spot
Spot instances allow you to
request spare Amazon EC2
computing capacity for up to 90%
off the On-Demand price.
For fault tolerant, instance flexible
or time-insensitive workloads
- 6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
長的漂亮是本錢
把錢花得漂亮是本事
- 7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
A Couple Assumptions…
1. You ’re u sing AWS…
2. You like it!!
3. B u t p rob ab ly want to sp e nd le ss
A Couple Assumptions…
- 8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What Are EC2 Spot Instances?
EC2 Spot Instances are
spare EC2 On-Demand capacity
with very simple rules…
- 9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What Are EC2 Spot Instances?
EC2 Spot Instances are
spare EC2 On-Demand capacity
with very simple rules…
- 10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Understanding EC2 Capacity
AZ1
AZ2
(N. California) Total Capacity
P3 C4 M4 I3 R4 D2
Shared
Dedicated
Shared
Dedicated
x 2x 4x x 2x 4x x 2x 4x x 2x 4x x 2x 4x x 2x 4x
- 11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Spare capacity at scale
- 12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Spare capacity at scale
- 13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$0.27 $0.29$0.50
2b 2c2a
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
C4
$1.76
On-
Demand
$0.88
$0.44
$0.22
$0.11
Capacity and Spot Markets Recap
• Each instance family
• Each instance size
• In each Availability Zone
• In every Region
• Is a separate pool of
capacity and therefore a
separate Spot Market
us-east-2
- 14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
M a k e a g u e s s ! H o w m u c h d o e s i t c o s t f o r a n h o u r ?
( 9 2 i n s t a n c e s , 2 * v C P U , 1 5 G i B r a m , v i a s p o t i n s t a n c e s )
- 15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
•Amazon EC2 Spot recap
•Overview of new EC2 Spot features (2017
Q3 & Q4 - Now)
- 16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Spot Instance Feature Overview
- 17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Spot Fleet tag propagation
- 18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Encrypt EBS volumes at launch
- 19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Encrypt EBS volumes at launch
yay!
- 20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Spot Fleet load balancer integration
- 21. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Spot Fleet Target capacity zero
- 22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Spot Fleet supports Target Tracking
- 23. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Low, Predictable Prices Eliminate the bid! No need to learn new APIs Pause & Resume with
Stop/Start & Hibernate
Smooth Price Changes,
Streamlined Access to Spot Capacity,
Instance Hibernation
- 24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Low, Predictable Prices Eliminate the bid!
Smooth Price Changes
- 25. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
New Pricing Model
- 26. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
New Pricing Model
New smooth pricing!
- 27. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
New Pricing Model, cont.
What does this mean?
• Reliable Spot cost models – prices will change less frequently (smooth
graphs)
• No more “bidding” – use “Maximum price”
• No requirement to even set maximum price
• No more “market” – use “Capacity pools” or “Pools of capacity”
• No more 10x price – maximum price capped at On-Demand price
- 28. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
No need to learn new APIs
S tre a m lin e d Acce ss to S p o t C a p a city
- 29. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Spot on RunInstances
$ aws ec2 run-instances --image-id ami-15e9c770
--count 1 --instance-type c4.large --instance-market-options MarketType=spot
- 30. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ aws ec2 run-instances --image-id ami-15e9c770
--count 1 --instance-type c4.large --instance-market-options MarketType=spot
Notice there is no bid/max price!!
Spot on RunInstances
- 31. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS
CloudFormation
AWS
OpsWorks
Amazon
EMR
Amazon
ECS
AWS Data
Pipeline
AWS BatchAuto Scaling
Spot integrated on AWS
- 32. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EC2 Spot with Amazon ECS
- 33. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EC2 Spot with EMR
S p o t f o r T a s k N o d e s
- 34. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EC2 Spot with AWS Batch
C o m p u t e E n v i r o n m e n t w i t h S p o t
- 35. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EC2 Spot with Kubernetes
• H y b r i d c l u s t e r w i t h
A S G + S p o t F l e e t
• D i v e r s i f i e d A l l o c a t i o n
S t r a t e g y
• R u n P o d s w i t h N o d e
S e l e c t o r
• T a i n t s a n d T o l e r a n c e
• P o d A u t o s c a l i n g
• C l u s t e r A u t o s c a l i n g
• D e r e g i s t e r E L B / T a r g e t
G r o u p o n S p o t
t e r m i n a t i o n
- 36. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Integrated in Community & Partners
- 37. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Pause & Resume with
Stop/Start & Hibernate
Instance Hibernation
- 38. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Pause & Resume on Spot
Set Instance Interruption Behavior at request time Spot manages instance lifecycle
for Stop and Hibernate
Terminate
HibernateStop
- 39. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Stop/Start
• Similar to EC2 Stop/Start
• Available for EBS-backed Instances across
instance types and OS
• Persistent Spot requests
- Spot fleet with “maintain” option
• Root volume and attached volumes persisted
• No additional charge
• ~2min warning intact
- 40. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Stop/Start – Use Cases
Workloads needing
lengthy provisioning
(e.g. software setup,
networking)
Stateful applications
that persist date to
durable storage for
use across sessions
Applications modifying
data in storage over
time (e.g. Dev/test
workloads)
Workstations
- 41. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hibernate/Resume
• Similar to closing and opening your laptop lid
• Available for EBS-backed Instances
• Persistent Spot requests only
Spot fleet with “maintain” option
• Root volume and attached EBS volumes persisted
• No additional charge
• Memory/RAM is persisted to root volume
- 42. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hibernate/Resume - Prerequisites
• Instance Type: C3, C4, M4, R3, R4 with memory < 100GB
• Size of EBS volume > size of memory
• Use pre-built AMI that has the Hibernation Agent (or) self-
install Agent on supported OS
Amazon Linux
Ubuntu
Windows
• Run the agent
Documentation:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-
hibernation.html
- 43. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hibernate/Resume – Use Cases
Long running tasks that
keep state in memory
HPC workloads Applications that keep lot of
state/cache in memory
- 44. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
- 45. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank You