8. Optimize by time of the day
Daily CPU Load
14
12
10
8
Load
6
25% Savings
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
Hour
9. www.MyWebSite.com
(dynamic data)
Amazon Route 53
media.MyWebSite.com
(DNS)
(static data)
Elastic Load
Balancer
Amazon
Auto Scaling group : Web Tier CloudFront
Amazon EC2
Auto Scaling group : App Tier
Amazon RDS Amazon Amazon S3
Availability Zone #1 RDS
Availability Zone #2
10. Optimize by seasonal cycles
Yearly CPU Load
12
10
8 50% Savings
Load
6
4
2
0
1 5 9 13 17 21 25 29 33 37 41 45 49
Weeks of the Year
11. Auto scaling : Types of Scaling
Scaling by Schedule
Use Scheduled Actions in Auto Scaling Service
• Date
• Time
• Min and Max of Auto Scaling Group Size
You can create up to 125 actions, scheduled up to 31 days into the
future, for each of your auto scaling groups. This gives you the ability
to scale up to four times a day for a month.
Scaling by Policy
Scaling up Policy - Double the group size
Scaling down Policy - Decrement by 1
12. Optimize during the month
End of the Month Scaling
3.5
3
DB Instance Type
2.5
2
1.5 75% Savings
1
0.5
0
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29
Days of the Month
13. End of the month processing
Expand the cluster at the end of the month
Expand/Shrink feature in Amazon Elastic MapReduce
Vertically Scale up at the end of the month
Modify-DB-Instance (in Amazon RDS) (or a New RDS DB Instance )
CloudFormation Script (in Amazon EC2)
14. Choosing the right pricing model
On-demand Instances vs. Reserved Instances
15. Steady State Usage
Total Cost for 1 Year-term of 2 application servers
Usage Fee One-time Fee Total Savings
Option 1 $1493 - $1493 -
On-Demand only
Option 2
On-Demand + $1008 $227 $1234 ~20%
Reserved
Option 3
All reserved
$528 $455 $983 ~35%
Total Cost for 3 Year-term of the same 2 application servers
Usage Fee One-time Fee Total Savings
Option 1 $4479 - $4479 -
On-Demand only
Option 2
On-Demand + $3024 $350 $3374 ~30%
Reserved
Option 3
All reserved
$1584 $700 $2284 ~50%
16. 450,000
On Demand 1-year RI 3-year RI
400,000
350,000
300,000
250,000
200,000
2
150,000
3
100,000
50,000 1
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
1-year RI versus On Demand:
1 cost savings realized after first 6 months of usage
3-year RI versus On Demand:
2 cost savings realized after first 9 months of usage.
3-year RI versus 1-year RI:
3 Net savings of 3-year RI versus 1-year RI begin by month 13 and
continue throughout the RI term (additional 23 months of
savings)
17. Recommendations
Steady State Usage : Use All Reserved
If you plan on running for at least 6 months, invest in RI
for 1-year term
If you plan on running for at least 8.7 months, invest in
RI for 3-year term
19. Recommendations
Steady State Usage : Use All Reserved
If you plan on running for at least 6 months, invest in RI
for 1-year term
If you plan on running for at least 8.7 months, invest in
RI for 3-year term
Unpredictable Demand : Use combination of Reserved
+ On-demand
With Reserved Instances, the costs average to an
effective hourly rate 40% lower than the On-Demand
rate.
22. Spot Use cases
Use Case Types of Applications
Batch Processing Generic background processing (scale out
computing)
Hadoop Hadoop/MapReduce processing type jobs (e.g.
Search, Big Data, etc.)
Scientific Computing Scientific trials/simulations/analysis in chemistry,
physics, and biology
Video and Image Transform videos into specific formats
Processing/Rendering
Testing Provide testing of software, web sites, etc
Web/Data Crawling Analyzing data and processing it
Financial Hedgefund analytics, energy trading, etc
HPC Utilize HPC servers to do embarrassingly parallel
jobs
Cheap Compute Backend servers for Facebook games
23. Basic tactics for Spot Instances
Try to launch Spot instances first and then on-demand
instances if you don’t get the spot instances in under
15 minutes
Use Spot and On-demand in Hybrid Fashion. Master
Node in Cluster is on-demand instance, worker nodes
are spot instances
25. Use of Amazon SQS in Spot Architectures
VisibilityTimeOut
Amazon EC2
Spot Instance
26.
27. Best Practices for using Spot Instances
Save Your Work Frequently
Add Checkpoints
Split up Your Work
Test Your Application
Minimize Group Instance Launches
Use Persistent Requests for Continuous Tasks
Track when Spot Instances Start and Stop
Access Large Pools of Compute Capacity
28. Case Study: Optimizing Video
Transcoding Workloads (On-demand + Spot + Reserved)
Free Offering Premium Offering
Optimize for reducing Optimized for Faster
cost response times
Acceptable Delay Limits No Delays
Implementation Implementation
Set Persistent Requests Invest in RIs
Use on-demand Use on-demand for
Instances, if delay Elasticity
Maximum Bid Price Maximum Bid Price
< On-demand Rate >= On-demand Rate
Get your set reduced Get Instant Capacity for
price for your workload higher price
29. Optimize by choosing the Right
Instance Type
M1.xlarge, c1.medium, multiple m1.small etc.
30. Basic recommendations on Instance Type
Choose the EC2 instance type that best matches the
resources required by the application
Start with memory requirements and architecture type
(32bit or 64-bit)
Then choose the closest number of virtual cores required
Scaling across AZs
Smaller sizes give more granularity for deploying to
multiple AZs
31. Tip – Instance Optimizer
Free Memory
Free CPU PUT 2 weeks
Free HDD
At 1-min
intervals Alarm
Amazon CloudWatch
Instance
Custom Metrics
“You could save a bunch of money by switching
to a small instance, Click on CloudFormation Script to
Save”
32. Optimize using AWS Import Export
AWS Import Export vs. Amazon S3 Standard Upload
35. Optimize by converting ancillary
instances into services
Leverage CloudWatch, SNS, SQS, SES, ELB
36. Load Balancing
Software LB on EC2 Elastic Load Balancing
Pros Pros
• Application-tier load • Elastic and Fault-tolerant
balancer • Auto scaling
• Monitoring included
Cons Cons
• SPOF • For Internet-facing traffic
• Elasticity has to be only
implemented manually
• Not as cost-effective
37. $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
38. 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
39. 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
40. Optimize for performance and
cost by page caching and
edge-caching static content
Amazon EC2 vs. Amazon S3 vs. Amazon CF + S3
41. When am I charged?
Paris
Client
Edge Location
Client
Amazon Simple Singapore
Storage Service
(S3)
Edge Location
London
Edge Location
Client
42. When content is popular…
Paris
Client
Edge Location
Client
Amazon Simple Singapore
Storage Service
(S3)
Edge Location
London
Edge Location
Client
43. Architectural Recommendations
We recommend using S3 + CF as it will reduce the
cost as well as reduce latency for static data
Depends on cache-hit ratio
For Video Streaming, use CF as there is no need of
separate streaming server running Adobe FMS
44. Optimize by using ‘Reminder scripts’
Turn off your unused EIPs, unassociated EBS
volumes
45. Summary: Tips on how to further save cost
Optimizing for the Cloud
Optimize based on demand
• Optimize by time of the day
• Optimize during the month
• Optimize by seasonal yearly cycles
Optimize by investing in Reserved Instances
Optimize using Spot instances
Choosing the right Instance Type
Optimize using AWS Import Export Service
Optimize by converting ancillary instances into services
Optimize for performance and cost by page caching and
edge-caching static content
Optimize by turning off unused resources
48. Optimize by Implementing Elasticity
Infrastructure
Cost $
Large You just lost
Capital customers
Expenditure
Predicted
Demand
Opportunity Traditional
Cost Hardware
Wastage
Actual
Demand
Cloud
Automated
Elasticity
time