8. 25% Savings
Web Servers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Hour
during a day
9. www.MyWebSite.com
(dynamic data)
Amazon Route 53
media.MyWebSite.com
(DNS)
(static content,
Elastic Load streaming media)
Balancer
Amazon
CloudFront
Auto Scaling group : Web Tier
Amazon EC2
Auto Scaling group : App Tier
Amazon RDS Amazon S3
Amazon
Availability Zone #1 RDS
Availability Zone #2
10. Auto scaling options
Scaling base on Policy
Scale up and down base on metrics
Scaling Up policy - Double the group size if avg cpu > 80%
Scaling Down policy - Decrement by 10% if avg cpu < 30%
Scaling by Schedule
Scheduled Actions to meet known demand
Scheduled up to 31 days into the future
Recurring scheduled scaling activities.
11. 75% Savings
Web Servers
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29
Days of the Month
during a month
15. Choosing an Instance Type
Start with the EC2 instance type that best matches
memory requirements
virtual cores
Tune your instance type to optimise for cost
No need to get it right first time
Run across AZs
Smaller sizes give more granularity for deploying across AZs
16. Knowing your usage
Free Memory
Free CPU PUT 2 weeks
Free HDD
At 1-min
intervals Alarm
Amazon CloudWatch
Instance
Custom Metrics
19. Optimize by using Reserved Instances
On-demand Reserved Spot
Instances Instances Instances
• Pay as you go • One time low • Requested Bid
upfront fee + Price and Pay as
lower hourly cost you go
• Starts from • $23 for 1 year • $0.005/Hour as
$0.025/Hour term and of today at 9 AM
$0.015/Hour
1-year and 3-
year terms
Heavy Medium Light
Utilization RI Utilization RI Utilization RI
20. Light Utilization RI
15-40% utilization
Lower costs up to 34%
Use Cases: Disaster Recovery, Weekly /
Monthly reporting, Elastic Map Reduce
21. Medium Utilization RI
41-79% utilization
Lower costs up to 49%
Use Cases: Web applications, many heavy
processing tasks, running much of the time
22. Heavy Utilization RI
> 80% utilization
Lower costs up to 58%
Use Cases: Databases, Large Scale HPC,
Always-on infrastructure, Baseline
23. Best RI for Utilisation
$18,000
$16,000
$14,000
$12,000
$10,000
Heavy
Medium
$8,000
Light
O-Demand
$6,000
$4,000
$2,000
$-
24. Optimizing Cost with RIs
14
12
10
On Demand
Light Utilization RI
8
Medium Utilization RI
Heavy utilization RI
6
4
2
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
27. Optimize by using Spot Instances
On-demand Reserved Spot
Instances Instances Instances
• Pay as you go • One time low • Requested Bid
upfront fee + Price and Pay
Pay as you go as you go
• Starts from • $23 for 1 year • $0.005/Hour
$0.025/Hour term and as of today at
$0.015/Hour 9 AM
28. What are Spot Instances?
Sold at Sold at
50%
Unused 54%
Unused
Discount! Discount!
Sold at Sold at
56%
Unused 59%
Unused
Discount! Discount!
Sold at Sold at
66%
Unused 63%
Unused
Discount! Discount!
Availability Zone Availability Zone
Region
29. What is the tradeoff?
Unused Unused
Unused
Reclaimed Unused
Unused
Reclaimed Unused
Availability Zone Availability Zone
Region
30.
31.
32. Architecting for Spot Instances
Decouple Components
Separate interactive and backend processing
Design for interruption
Use SQS, SWF
data in a durable store
save progress regularly
33. Use Cases for Spot
Financial Modelling
Analytics Testing Scientific Computing
and Analysis
Geospatial Analysis Media Encoding Web Crawling Big Data
36. Strategy: Optimize for Cost
Engineered application towards a cost
Set low maximum bid price to minimize costs
Comfortable if process takes longer or jobs were re-run
When interrupted, no charge for that hour.
38. Strategy: Price History Momentum
Monitor spot market price
Bid 10% above Average Spot Price of the Last Hour
Maximum bid of 80% of On-Demand Price
Expect fewer interruptions than Optimize for Cost
40. Strategy: Discount over On-Demand
Bid around the On-Demand price
Use On-Demand instance when Spot Price exceeds On-Demand
price (or slightly higher)
May pay more some hours, but on average they pay significantly
less
This bidding strategy ensures a discount over On-Demand
41. Strategy: Discount over On-Demand
Switch to Substantial
On-DemandBack Savings
Switch
to Spot
Much lower
costs than
On-Demand
45. $0.028
per hour
DNS Elastic Load
Web Servers
Balancer
Availability Zone
$0.095
per hour
(small instance)
EC2 instance
DNS + software LB Web Servers
Availability Zone
46. Consumers
Producer SQS queue
$0.01 per
10,000 Requests
($0.000001 per Request)
$0.095
per hour
(small instance) Producer
EC2 instance Consumers
+ software queue
47. Software v/s Services
Software on EC2 SNS, SQS, SES
Pros Pros
• Custom features • Pay as you go
• Scalability
Cons • Availability
• Requires an instance • High performance
• SPOF
• Limited to one AZ
• DIY administration