The document discusses cost optimization strategies when using AWS. It outlines 5 steps for cost optimization: elastic capacity, choosing optimal instance types, using reserved instances, spot instances, and complementary services. It provides details on each step, such as how to use auto-scaling for elastic capacity and how reserved instances offer significant hourly discounts for steady usage. The document aims to help users "do more, use less" by realizing cost-aware architectures on AWS.
2. Cost Optimization
A key step in the cloud journey
Realize cost aware architectures
Use elasticity to gain real and measurable benefit
Do more, use less
6. Why optimize?
Utility
Compute and Storage
are a utility so ‘turning
off’ should be natural
7. Why optimize?
Utility Efficiency
Compute and Storage Efficiency allows
are a utility so ‘turning more to be done
off’ should be natural within a given budget
8. Why optimize?
Utility Efficiency Architecture
Compute and Storage Efficiency allows Cost awareness drives
are a utility so ‘turning more to be done adoption of 21st century
off’ should be natural within a given budget architectures
9. Turn off the lights
When you stop EC2 resources you stop
paying for them
10. Be elastic
Support workloads with the right
amount of horsepower to get the job
done
17. Traditional capacity required
Server Load
Capacity of 1 Server
1 Server for 8 hours
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 of day
18. Traditional capacity required
Server Load
Capacity of 1 Server
1 Server for 8 hours 1 Server for 8 hours
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 of day
19. Traditional capacity required
1 Server for 8 hours
Server Load
Capacity of 1 Server
1 Server for 8 hours 1 Server for 8 hours
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 of day
20. Traditional capacity required
1 Server for 8 hours
Server Load
Capacity of 1 Server
1 Server for 8 hours 1 Server for 8 hours 1 Server for 8 hours
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 of day
21. Traditional capacity required
Server Load
Capacity of 1 Server
1/3rd
Saving
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 of day
31. Auto-scaling policies
Manually By Schedule
Send an API call or use CLI to Scale up/down based on date
launch/terminate instances – and time
Only need to specify capacity
change (+/-)
By Policy Auto-Rebalance
Scale in response to changing Instances are automatically
conditions, based on user launched/terminated to
configured real-time ensure the application is
monitoring and alerts balanced across multiple Azs
32. Auto-scaling policies
Scaling base on Policy Scaling by Schedule
Scale up and down base on metrics Scheduled Actions to meet known
demand
Scaling Up policy - Double the group
size if avg cpu > 80% Scheduled up to 31 days into the future
Scaling Down policy - Decrement by Recurring scheduled scaling activities
10% if avg cpu < 30%
37. Instance types
Start
Choose instance that
meets your basic
requirements best
Match memory & virtual
cores
38. Instance types
Start Tune
Choose instance that Change instance size up
meets your basic or down based upon
requirements best monitoring
Match memory & virtual Use trusted advisor to
cores assess
39. Instance types
Start Tune Spread
Choose instance that Change instance size up Run instances across
meets your basic or down based upon multiple availability
requirements best monitoring zones
Match memory & virtual Use trusted advisor to Smaller sizes equals
cores assess greater granularity
40. Know your usage
Free Memory
Free CPU
Free HDD
PUT 2 weeks
…
Custom Metrics
…
Amazon
Instance At 1-min intervals Alarm
CloudWatch
42. Choose your metric
optimize for the metric
Cost per unit of work per instance(size)
Workload A Workload B Workload C
Optimal on 4x Optimal on 10x Optimal on 2x
m1.xlarge m1.medium m3.xxlarge
43. Choose your metric
optimize for the metric
Cost per unit of work per instance(size)
100 concurrent jobs on 10 x m1.large @ $0.24 / hr = $ 0.024 / job
vs
300 concurrent jobs on 10 x m3.xlarge @ $0.50 / hr = $ 0.016 / job
44. Choose your metric
optimize for the metric
Think workload density
Don’t focus on instance hourly rate per se
46. Master Account
aws.invoices@mycompany.com
consolidated billing information
Division B
admin@divisionB.com
IAM User2
Dev2
Admin2
47. Master Account
aws.invoices@mycompany.com
consolidated billing information Tags: (key-
value)
Division B e.g Own=Div
Proj=R
admin@divisionB.com
IAM User2
Dev2
Admin2
Tags: Tags: Tags:
Own=Div Own=Div Own=Div
Proj=P Proj=Q Proj=R
48. Master Account
aws.invoices@mycompany.com
consolidated billing information
Operating Co. A Division B Business Unit C
admin@opcoa.com admin@divisionB.com admin@busUnitC.com
User1 User2 User3
IAM
IAM
IAM
Dev1 Dev2 Dev3
Admin1 Admin2 Admin3
Tags: Tags: Tags: Tags: Tags: Tags: Tags: Tags: Tags:
Own=OpCo Own=OpCo Own=OpCo Own=Div Own=Div Own=Div Own=BusC Own=BusC Own=BusC
Proj=A Proj=B Proj=C Proj=P Proj=Q Proj=R Proj=X Proj=Y Proj=Z
49. Master Account
aws.invoices@mycompany.com
consolidated billing information
Operating Co. A Division B Business Unit C
admin@opcoa.com admin@divisionB.com admin@busUnitC.com
User1 User2 User3
IAM
IAM
IAM
Dev1 Dev2 Dev3
Admin1 Admin2 Admin3
Tags: Tags: Tags: Tags: Tags: Tags: Tags: Tags: Tags:
Own=OpCo Own=OpCo Own=OpCo Own=Div Own=Div Own=Div Own=BusC Own=BusC Own=BusC
Proj=A Proj=B Proj=C Proj=P Proj=Q Proj=R Proj=X Proj=Y Proj=Z
50. Programmatic billing access
Master Account
aws.invoices@mycompany.com
S3 CSV
consolidated billing information
Operating Co. A Division B Business Unit C
admin@opcoa.com admin@divisionB.com admin@busUnitC.com
User1 User2 User3
IAM
IAM
IAM
Dev1 Dev2 Dev3
Admin1 Admin2 Admin3
Tags: Tags: Tags: Tags: Tags: Tags: Tags: Tags: Tags:
Own=OpCo Own=OpCo Own=OpCo Own=Div Own=Div Own=Div Own=BusC Own=BusC Own=BusC
Proj=A Proj=B Proj=C Proj=P Proj=Q Proj=R Proj=X Proj=Y Proj=Z
51. Programmatic billing access
Master Account
aws.invoices@mycompany.com
S3 CSV
consolidated billing information
Operating Co. A Division B Business Unit C
admin@opcoa.com admin@divisionB.com admin@busUnitC.com
User1 User2 User3
IAM
IAM
IAM
Dev1 Dev2 Dev3
Admin1 Admin2 Admin3
Tags: Tags: Tags: Tags: Tags: Tags: Tags: Tags: Tags:
Own=OpCo Own=OpCo Own=OpCo Own=Div Own=Div Own=Div Own=BusC Own=BusC Own=BusC
Proj=A Proj=B Proj=C Proj=P Proj=Q Proj=R Proj=X Proj=Y Proj=Z
52. Basic Offering
24x7x365 ✓
Developer Forum Access ✓
Documentation ✓
Business Access to support Phone, Chat,
Email
Enterprise Named Contacts 5
Fastest Response Time 1 Hour
Architecture Support Use Case
Guidance
Best Practice ✓
Diagnostics Tools ✓
Direct Routing ✓
3rd Party Software ✓
Trusted Advisor ✓
57. Reserved instances
On-demand instances
Unix/Linux instances start at
$0.02/hour
Pay as you go for compute power
Low cost and flexibility
Pay only for what you use, no up-front
commitments or long-term contracts
Use Cases:
Applications with short term, spiky, or
unpredictable workloads;
Application development or testing
58. Reserved instances
On-demand instances Reserved instances
Unix/Linux instances start at 1- or 3-year terms
$0.02/hour
Pay low up-front fee, receive significant hourly
Pay as you go for compute power discount
Low cost and flexibility Low Cost / Predictability
Pay only for what you use, no up-front Helps ensure compute capacity is available
commitments or long-term contracts when needed
Use Cases:
Use Cases:
Applications with short term, spiky, or
unpredictable workloads; Applications with steady state or predictable
usage
Application development or testing
Applications that require reserved capacity,
including disaster recovery
59. Reserved instances Heavy utilization RI
> 80% utilization
Lower costs up to 58%
On-demand instances Reserved instances Use Cases: Databases, Large Scale HPC,
Always-on infrastructure, Baseline
Unix/Linux instances start at 1- or 3-year terms
$0.02/hour
Pay low up-front fee, receive significant hourly
Pay as you go for compute power discount
Low cost and flexibility Low Cost / Predictability
Pay only for what you use, no up-front Helps ensure compute capacity is available
commitments or long-term contracts when needed
Use Cases:
Use Cases:
Applications with short term, spiky, or
unpredictable workloads; Applications with steady state or predictable
usage
Application development or testing
Applications that require reserved capacity,
including disaster recovery
60. Reserved instances Heavy utilization RI
> 80% utilization
Lower costs up to 58%
On-demand instances Reserved instances Use Cases: Databases, Large Scale HPC,
Always-on infrastructure, Baseline
Unix/Linux instances start at 1- or 3-year terms
$0.02/hour
Pay low up-front fee, receive significant hourly Medium utilization RI
Pay as you go for compute power discount
Low cost and flexibility Low Cost / Predictability 41-79% utilization
Lower costs up to 49%
Pay only for what you use, no up-front Helps ensure compute capacity is available Use Cases: Web applications, many heavy
commitments or long-term contracts when needed processing tasks, running much of the time
Use Cases:
Use Cases:
Applications with short term, spiky, or
unpredictable workloads; Applications with steady state or predictable
usage
Application development or testing
Applications that require reserved capacity,
including disaster recovery
61. Reserved instances Heavy utilization RI
> 80% utilization
Lower costs up to 58%
On-demand instances Reserved instances Use Cases: Databases, Large Scale HPC,
Always-on infrastructure, Baseline
Unix/Linux instances start at 1- or 3-year terms
$0.02/hour
Pay low up-front fee, receive significant hourly Medium utilization RI
Pay as you go for compute power discount
Low cost and flexibility Low Cost / Predictability 41-79% utilization
Lower costs up to 49%
Pay only for what you use, no up-front Helps ensure compute capacity is available Use Cases: Web applications, many heavy
commitments or long-term contracts when needed processing tasks, running much of the time
Use Cases:
Use Cases:
Applications with short term, spiky, or Light utilization RI
unpredictable workloads; Applications with steady state or predictable
usage
Application development or testing 15-40% utilization
Applications that require reserved capacity, Lower costs up to 34%
including disaster recovery
Use Cases: Disaster Recovery, Weekly /
Monthly reporting, Elastic Map Reduce
62. Best RI for Utilisation
$18,000
$16,000
$14,000
$12,000
$10,000
Heavy
Medium
$8,000
Light
$6,000 O-Demand
$4,000
$2,000
$-
63. Best RI for Utilisation
$18,000
$16,000
$14,000
$12,000
$10,000
Heavy
Medium
$8,000
Light
$6,000 O-Demand
$4,000
$2,000
$-
64. Optimizing costs with RIs
14
12
10
On Demand
8
Light Utilization RI
6 Medium Utilization RI
Heavy utilization RI
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
68. Spot instances
On-demand instances Reserved instances
Unix/Linux instances start at 1- or 3-year terms
$0.02/hour
Pay low up-front fee, receive significant hourly
Pay as you go for compute power discount
Low cost and flexibility Low Cost / Predictability
Pay only for what you use, no up-front Helps ensure compute capacity is available
commitments or long-term contracts when needed
Use Cases:
Use Cases:
Applications with short term, spiky, or
unpredictable workloads; Applications with steady state or predictable
usage
Application development or testing
Applications that require reserved capacity,
including disaster recovery
69. Spot instances
On-demand instances Reserved instances Spot instances
Unix/Linux instances start at 1- or 3-year terms Bid on unused EC2 capacity
$0.02/hour
Pay low up-front fee, receive significant hourly Spot Price based on supply/demand,
Pay as you go for compute power discount determined automatically
Low cost and flexibility Low Cost / Predictability Cost / Large Scale, dynamic workload handling
Pay only for what you use, no up-front Helps ensure compute capacity is available
commitments or long-term contracts when needed
Use Cases:
Use Cases:
Use Cases: Applications with flexible start and end times
Applications with short term, spiky, or
unpredictable workloads; Applications with steady state or predictable Applications only feasible at very low compute
usage prices
Application development or testing
Applications that require reserved capacity,
including disaster recovery
77. If your bid < spot price
Your instance is terminated
78. Architecting for spot instances
Decouple components Design for interruption
Separate interactive & backend Use SQS, SWF
processing
Place data in a durable store such as S3,
Use frameworks such as Elastic SimpleDB or DynamoDB
MapReduce
Save progress regularly
84. Spot bidding strategies
Bid Distribution (for 3 months period)
20%
Percentage of the Distribution
18%
16%
14%
12%
10%
8%
6%
4%
2%
0%
Bid Price as Percentage of the On-Demand Price
85. Spot bidding strategies
Bid Distribution (for 3 months period)
20%
Percentage of the Distribution
18%
16%
14%
12%
Bid near the RI
10%
8%
hourly price
6%
4%
2%
0%
Bid Price as Percentage of the On-Demand Price
86. Spot bidding strategies
Bid Distribution (for 3 months period)
20%
Percentage of the Distribution
18%
16%
14%
12%
Bid above the spot price
10%
8%
history
6%
4%
2%
0%
Bid Price as Percentage of the On-Demand Price
87. Spot bidding strategies
Bid Distribution (for 3 months period)
20%
Percentage of the Distribution
18%
16%
14%
12% Bid near the
10% on-demand
8% price
6%
4%
2%
0%
Bid Price as Percentage of the On-Demand Price
88. Spot bidding strategies
Bid Distribution (for 3 months period)
20%
Percentage of the Distribution
18%
16%
14%
12%
10% Bid above the on-demand price
8%
6%
4%
2%
0%
Bid Price as Percentage of the On-Demand Price
89. Bid near the reserved hourly price
You only pay for a full hour
90. Bid near the reserved hourly price
You only pay for a full hour
(if you are interrupted the hour is free)
91. Bid above the on-demand price
Expect fewer interruptions
92. Bid above the on-demand price
Expect fewer interruptions
(only pay the spot price)
97. $0.025
per hour DNS Elastic Load Web Servers
Balancer
Availability Zone
98. $0.025
per hour DNS Elastic Load Web Servers
Balancer
Availability Zone
VS
$0.06
per hour EC2 instance
(small instance) DNS Web Servers
+ software LB
Availability Zone
99. Consumers
Producer SQS queue
$0.01 per
10,000 Requests
($0.000001 per Request)
100. Consumers
Producer SQS queue
$0.01 per
10,000 Requests
($0.000001 per Request)
VS
$0.06
per hour Producer
(small instance) EC2 instance Consumers
+ software queue
101. Software vs Services
Software on EC2 AWS Services
Pros: ELB, SNS, SQS, SES, SWF, DynamoDB etc
Use custom features
Pros:
Pay as you go
Cons:
Scalability
Requires an instance
Availability
SPOF
High performance
Limited to one AZ
DIY administration