SlideShare a Scribd company logo
COST OPTIMIZATION

Glen Robinson– Solutions Architect
Elastic Capacity
Elasticity is a fundamental
property of the cloud that drives
 many of its economic benefits
When you turn off your cloud resources,
     you actually stop paying for them
6 am
10 am
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
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 S3
                                         Amazon
Availability Zone #1                     RDS



          Availability Zone #2
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
Horizontal Scaling
       vs.
 Vertical Scaling
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
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)
Reserved Instances
Reserved Instances
 New Reserved instances
  Light Utilization
  Medium Utilization
  Heavy Utilization
Light Utilization RI
 15-40% utilization
 Lower costs up to 33%
 Use Cases: Disaster Recovery, periodic
 processing (e.g. EMR)
Medium Utilization RI
 The old RI
 41-79% utilization
 Lower costs up to 49%
 Use Cases: Web applications, many heavy
 processing tasks
Heavy Utilization RI
 > 80% utilization
 Lower costs up to 59%
 Use Cases: Databases, Large Scale HPC,
 Always-on infrastructure, Baseline
Optimizing Cost with RIs
$18,000


$16,000


$14,000


$12,000


$10,000
                           Heavy
                           Medium
 $8,000
                           Light
                           O-Demand
 $6,000


 $4,000


 $2,000


    $-
Optimizing Cost with RIs
  14




  12




  10
                                                                             On Demand

   8
                                                                             Light Utilization RI

                                                                             Medium Utilization RI

   6                                                                         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
http://d36cz9buwru1tt.cloudfront.net/AWS_Pricing_Overview.pdf
Instance Types
Cloud Economics: Optimising for Cost
Cloud Economics: Optimising for Cost
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
Tip – Instance Optimizer




             Free Memory
              Free CPU        PUT                       2 weeks
              Free HDD
               At 1-min
               intervals                                          Alarm
                                    Amazon CloudWatch

  Instance

             Custom Metrics
Spot Instances
           Bid on unused Amazon EC2 capacity.
Run instances as long as bid exceeds the current Spot Price
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
What is the tradeoff?



              Unused                                           Unused




                        Unused
                       Reclaimed             Unused




   Unused
  Reclaimed                                                    Unused



                         Availability Zone            Availability Zone




                                                               Region
Cloud Economics: Optimising for Cost
Cloud Economics: Optimising for Cost
Bidding Strategies
Strategy: Optimize for Cost
 Engineered application towards a cost
 Set low maximum bid price to minimize costs
 Were comfortable if process ran longer or jobs were re-run
 Did not pay for hour if they are interrupted
$$$$$$$$$$$$$$$$$$ $$$   $   $   $   $
Strategy: Price History Momentum

 Price Set 10% above Average Price Last Hour
 Maximum price threshold of 80% of On-Demand Price
 One time spot requests; one instance per request; across all
 availability zones
 Not more than 10 open Spot requests at any time
 Spot requests expire in 10 minute
Strategy: Price History Momentum
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
Cloud Economics: Optimising for Cost
Strategy: Discount over On-Demand

                      Switch to   Substantial
                     On-DemandBack Savings
                        Switch
                          to Spot




                                    Much lower
                                    costs than
                                    On-Demand
Strategy: Minimize Interruption
                                        ~57%
                                       Savings




                                  On Average
                                  Substantial
                                   Savings
Cloud Economics: Optimising for Cost
aws.amazon.com/ec2/spot-instances
Complementary
  services
$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
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
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
1. Elastic Capacity

2. Reserved Instances

3. Spot   Instances

4. Instance   Types

5. Complementary services
aws.amazon.com/calculator
Cloud Economics: Optimising for Cost
THANK YOU
aws.amazon.com
Cloud Economics: Optimising for Cost

More Related Content

Cloud Economics: Optimising for Cost

  • 3. Elasticity is a fundamental property of the cloud that drives many of its economic benefits
  • 4. When you turn off your cloud resources, you actually stop paying for them
  • 7. 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
  • 8. 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 S3 Amazon Availability Zone #1 RDS Availability Zone #2
  • 9. 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
  • 10. Horizontal Scaling vs. Vertical Scaling
  • 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
  • 12. 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. Reserved Instances New Reserved instances  Light Utilization  Medium Utilization  Heavy Utilization
  • 15. Light Utilization RI 15-40% utilization Lower costs up to 33% Use Cases: Disaster Recovery, periodic processing (e.g. EMR)
  • 16. Medium Utilization RI The old RI 41-79% utilization Lower costs up to 49% Use Cases: Web applications, many heavy processing tasks
  • 17. Heavy Utilization RI > 80% utilization Lower costs up to 59% Use Cases: Databases, Large Scale HPC, Always-on infrastructure, Baseline
  • 18. Optimizing Cost with RIs $18,000 $16,000 $14,000 $12,000 $10,000 Heavy Medium $8,000 Light O-Demand $6,000 $4,000 $2,000 $-
  • 19. Optimizing Cost with RIs 14 12 10 On Demand 8 Light Utilization RI Medium Utilization RI 6 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
  • 24. 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
  • 25. Tip – Instance Optimizer Free Memory Free CPU PUT 2 weeks Free HDD At 1-min intervals Alarm Amazon CloudWatch Instance Custom Metrics
  • 26. Spot Instances Bid on unused Amazon EC2 capacity. Run instances as long as bid exceeds the current Spot Price
  • 27. 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
  • 28. What is the tradeoff? Unused Unused Unused Reclaimed Unused Unused Reclaimed Unused Availability Zone Availability Zone Region
  • 32. Strategy: Optimize for Cost Engineered application towards a cost Set low maximum bid price to minimize costs Were comfortable if process ran longer or jobs were re-run Did not pay for hour if they are interrupted
  • 34. Strategy: Price History Momentum Price Set 10% above Average Price Last Hour Maximum price threshold of 80% of On-Demand Price One time spot requests; one instance per request; across all availability zones Not more than 10 open Spot requests at any time Spot requests expire in 10 minute
  • 36. 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
  • 38. Strategy: Discount over On-Demand Switch to Substantial On-DemandBack Savings Switch to Spot Much lower costs than On-Demand
  • 39. Strategy: Minimize Interruption ~57% Savings On Average Substantial Savings
  • 43. $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
  • 44. 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
  • 45. 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
  • 46. 1. Elastic Capacity 2. Reserved Instances 3. Spot Instances 4. Instance Types 5. Complementary services