9. 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
Optimize by the time of day
10. 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
11. Web Servers 50% Savings
1 5 9 13 17 21 25 29 33 37 41 45 49
Week
Optimize during a year
12. 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
13. Auto scaling Best Practices
Use Auto Scaling Tags
Use Auto scaling Alarms and Email Notifications
Scale up and down symmetrically
Scale up quickly and scaling down slowly
Auto Scaling across Availability Zones
Leverage Suspend and Resume Processes
14. Example:
Scale up by 10%
if CPU utilization is greater than 60%
for 5 minutes,
Scale down by 10%
if CPU utilization is less than 30%
for 20 minutes.
16. RDS DB Servers 75% Savings
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29
Days of the Month
Optimize during a month
17. 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)
19. AWS Support – Trusted Advisor –
Your personal cloud assistant
20. 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”
$$$ in
Savings
21. Optimizing for Cost…
#1 Use only what you need (use Auto Scaling Service, modify–db)
#2 Invest time in Reserved Pricing analysis (EC2, RDS)
22. Save more when you reserve
On-demand Reserved
Instances Instances Heavy
Utilization RI
• Pay as you go • One time low
upfront fee + 1-year and 3- Medium
Pay as you go year terms Utilization RI
• Starts from • $23 for 1 year
term and Light
$0.02/Hour Utilization RI
$0.01/Hour
23. The Total Cost Of (Non) Ownership in the
Cloud Whitepaper (New!)
Whitepaper: http://bit.ly/aws-tco-webapps
24. Web Application Usage Patterns
Steady State Spiky Predictable Uncertain unpredictable
Usage Pattern Usage Pattern Usage Pattern
(Example: Corporate Website) (Example: Marketing (Example: Social game or
Promotions Website) Mobile Website)
25. www.MyWebSite.com
(dynamic data)
Example: TCO of a Amazon Route 53
media.MyWebSite.com
(DNS)
3-tier Web Application Elastic Load
(static data)
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
26. $14.000
m2.xlarge running Linux in US-East Region
$12.000
over 3 Year period
Break-even
$10.000 point
$8.000
Cost
Heavy Utilization
$6.000 Medium Utilization
Light Utilization
$4.000
On-Demand
$2.000
$-
Utilization
Utilization Sweet Spot Feature Savings over On-Demand
<10% On-Demand No Upfront Commitment
10% - 40% Light Utilization RI Ideal for Disaster Recovery Up to 56% (3-Year)
40% - 75% Medium Utilization RI Standard Reserved Capacity Up to 66% (3-Year)
>75% Heavy Utilization RI Lowest Total Cost Up to 71% (3-Year)
Ideal for Baseline Servers
28. TCO of Spiky Predictable Web Application
TCO Web Application - Spiky Usage Pattern
On-Premises AWS Option 1 AWS Option 2 AWS Option 3
Amortized monthly costs All Reserved Mix of On-Demand All On-Demand
Option
over 3 years and Reserved
Option 1: All Reserved
Compute/Server Costs
Server Hardware $510 $0 $0 $0
Network Hardware $103 $0 $0 $0
Option 2: Mix of On-Demand and Reserved
Hardware Maintenance
Recommended Option (Most Cost- $78 $0 $0 $0
effective)Power and Cooling $286 $0 $0 $0
Data Center Space $240 $0 $0 $0
Personnel $2,000 $0 $0 $0
Option 3: AWS Instances
All On-Demand $0 $992 $881 $1,940
Commitment-free and Risk-free Option
Total - Per Month $3,220 $992 $881 $1,940
Total - 3 Years $115,920 $35,717 $31,731 $69,854
Savings over On-premises
69% 72% 40%
Option
29. Recommendations
Steady State Usage Pattern
• For 100% utilization
• 3-Year Heavy RI (for maximum savings over on-demand)
Spiky Predictable Usage Pattern
• Baseline
• 3-Year Heavy RI (for maximum savings over on-demand)
• 1-Year Light RI (for lowest upfront commitment) + savings over on-demand
• Peak: On-Demand
Uncertain and unpredictable Usage Pattern
• Start out small with On-Demand Instances (risk-free and commitment-
free)
• Switch to some combination of Reserved and On-Demand, if application is
successful
• If not successful, you walk away having spent a fraction of what you would
pay to buy your own technology infrastructure
30.
31.
32. Optimizing for Cost…
#1 Use only what you need (use Auto Scaling Service, modify–db)
#2 Invest time in Reserved Pricing analysis (EC2, RDS)
#3 Architect for Spot Instances (bidding strategies)
33. 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.02/Hour term and as of today at
$0.01/Hour 9 AM
1-year and 3-
year terms
Heavy Medium Light Utilization
Utilization RI Utilization RI RI
34. 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
35. What is the tradeoff?
Unused Unused
Unused
Reclaimed Unused
Unused
Reclaimed Unused
Availability Zone Availability Zone
Region
36. 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
37. Save more money by using Spot Instances
Reserved Hourly Price > Spot Price < On-Demand Price
39. Typical Spot Bidding Strategies
Bid Distribution (for last 3 months)
20% 1. Bid near the
18%
Reserved
Hourly Price
Percentage of the Distribution
16%
14%
2. Bid above the
12% Spot Price
10% History
8%
3. Bid near On-
6%
Demand Price
4%
2% 4. Bid above the
0% On-Demand
Price
Bid Price as Percentage of the On-Demand Price
40. 1. Bid Near the Reserved Hourly Price
$$$$$$$$$$$$$$$$$$ $$$ $ $ $ $
66% Savings over
On-Demand
41. 2. Bid above the Spot Price History
50% Savings over
On-Demand
42. 3. Bid near the On-Demand Price
50% Savings over
On-Demand
43. 4. Bid above the On-Demand Price
57% Savings over
On-Demand
47. Made for each other: MapReduce + Spot
Use Case: Web crawling/Search
using Hadoop type clusters. Use
Reserved Instances for their DB
workloads and Spot instances for
their indexing clusters. Launch
100’s of instances.
Bidding Strategy: Bid a little
above the On-Demand price to
prevent interruption.
Interruption Strategy: Restart
the cluster if interrupted
66% Savings over
On-Demand
49. Use of Amazon SQS in Spot Architectures
VisibilityTimeOut
Amazon EC2
Spot Instance
50. Optimizing Video Transcoding Workloads
Free Offering Premium Offering
• Optimize for reducing cost Optimized for Faster response times
• Acceptable Delay Limits No Delays
Implementation Implementation
• Set Persistent Requests Invest in RIs
• Use on-demand Instances, if Use on-demand for Elasticity
delay
Maximum Bid Price Maximum Bid Price
< On-demand Rate >= On-demand Rate
Get your set reduced price for Get Instant Capacity for higher price
your workload
52. Architecting for Spot Instances : Best Practices
Manage interruption
• Split up your work into small increments
• Checkpointing: Save your work frequently and periodically
Test Your Application
Track when Spot Instances Start and Stop
Spot Requests
• Use Persistent Requests for continuous tasks
• Choose maximum price for your requests
53. Optimizing for Cost…
#1 Use only what you need (use Auto Scaling Service, modify–db)
#2 Invest time in Reserved Pricing analysis (EC2, RDS)
#3 Architect for Spot Instances (bidding strategies)
#4 Leverage Application Services (ELB, SNS, SQS, SWF, SES)
54. Optimize by converting ancillary instances into
services
Monitoring: CloudWatch
Notifications: SNS
Queuing: SQS
SendMail: SES
Load Balancing: ELB
Workflow: SWF
Search: CloudSearch
55. Elastic Load Balancing
Software LB on EC2 Elastic Load Balancing
Pros Pros
Application-tier load Elastic and Fault-tolerant
balancer
Auto scaling
Monitoring included
Cons
SPOF Cons
Elasticity has to be For Internet-facing traffic
implemented manually only
Not as cost-effective
56. $0.025
per hour
DNS Elastic Load
Web Servers
Balancer
Availability Zone
$0.08
per hour
(small instance)
EC2 instance
DNS + software LB Web Servers
Availability Zone
57. Application Services
Software on EC2 SNS, SQS, SES, SWF
Pros Pros
Custom features Pay as you go
Scalability
Cons Availability
Requires an instance High performance
SPOF
Limited to one AZ
DIY administration
58. Consumers
Producer SQS queue
$0.01 per
10,000 Requests
($0.000001 per Request)
$0.08
per hour
(small instance) Producer
EC2 instance Consumers
+ software queue
59. Optimizing for Cost…
#1 Use only what you need (use Auto Scaling Service, modify–db)
#2 Invest time in Reserved Pricing analysis (EC2, RDS)
#3 Architect for Spot Instances (bidding strategies)
#4 Leverage Application Services (ELB, SNS, SQS, SWF, SES)
#5 Implement Caching (ElastiCache, CloudFront)
60. caching
Optimize for performance and cost
by page caching and edge-caching static content
61. When am I charged?
Paris
Client
Edge Location
Amazon Simple
Storage Service
(S3) Client
Singapore
Amazon Elastic
Compute Cloud
(EC2)
Edge Location
London
Edge Location
Client
62. When content is popular…
Paris
Client
Edge Location
Amazon Simple
Storage Service
(S3)
Client
Singapore
Amazon Elastic
Compute Cloud
(EC2)
Edge Location
London
Edge Location
Client
63. Architectural Recommendations
Use Amazon S3 + CloudFront as it will reduce the cost as well
as reduce latency for static data
• Depends on cache-hit ratio
For Video Streaming, use CloudFront as there is no need of a
separate streaming server running Adobe FMS
Use managed caching service (Amazon ElastiCache)
64. Number of ways to further save with AWS…
#1 Use only what you need (use Auto Scaling Service, modify–db)
#2 Invest time in Reserved Pricing analysis (EC2, RDS)
#3 Architect for Spot Instances (bidding strategies)
#4 Leverage Application Services (ELB SNS, SQS, SWF, SES)
#5 Implement Caching (ElastiCache, CloudFront)