Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Optimizing Your Infrastructure Costs on AWS

5,403 views

Published on

Published in: Technology, Business
  • Be the first to comment

Optimizing Your Infrastructure Costs on AWS

  1. 1. Optimizing for Cost in the Cloud Miles Ward miward@amazon.com Solutions Architect 4/18/2012 AWS Summit 2012 - NYC
  2. 2. Multiple dimensions of optimizations Cost Performance Response time Time to market High-availability Scalability Security Manageability …….
  3. 3. Optimizing for Cost… #1 Use only what you need (use Auto Scaling Service, modify–db)
  4. 4. Turn off what you don’t need (automatically)
  5. 5. 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 HourOptimize by the time of day
  6. 6. Auto scaling : Types of ScalingScaling 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
  7. 7. 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 AmazonAvailability Zone #1 RDS Availability Zone #2
  8. 8. Web Servers 50% Savings 1 5 9 13 17 21 25 29 33 37 41 45 49 WeekOptimize during a year
  9. 9. RDS DB Servers 75% Savings 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 Days of the MonthOptimize during a month
  10. 10. Optimize by using “Reminder scripts”Disassociate your unused EIPsDelete unassociated EBS volumesDelete older EBS snapshotsLeverage S3 Object expiration
  11. 11. Tip – Instance Optimizer Free Memory Free CPU PUT 2 weeks Free HDD At 1-min intervals Alarm Amazon CloudWatchInstance Custom Metrics “You could save a bunch of money by switching to a smaller instance, Click on CloudFormation Script to Save”
  12. 12. Optimize by choosing the Right Instance TypeChoose the EC2 instance type that best matches the resourcesrequired by the application• Start with memory requirements and architecture type (32bit or 64- bit)• Then choose the closest number of virtual cores requiredScaling across AZs• Smaller sizes give more granularity for deploying to multiple AZs
  13. 13. Optimizing for Cost… #1 Use only what you need (use Auto Scaling Service, modify–db) #2 Invest time in Reserved Pricing analysis (EC2, RDS)
  14. 14. Your Best Option: Reserved + On-Demand
  15. 15. 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
  16. 16. $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 $4,000 Light Utilization On-Demand $2,000 $- UtilizationUtilization Sweet Spot Feature Savings over On-Demand<10% On-Demand No Upfront Commitment10% - 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
  17. 17. RecommendationsSteady State Usage Pattern• For 100% utilization • 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 termSpiky 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-DemandUncertain and unpredictable Usage Pattern• Baseline: 3-Year Heavy RIs• Median: 1-Year or 3-Year Light RIs• Peak: On-Demand
  18. 18. Example: Simple 3-Tier Web Application Description Option 1 Option 2 Option 3 Option 4 2 Web servers 2 On-Demand 2 On-Demand 1 On-Demand and 1 On-Demand and 1 Reserved Medium 1 Reserved Light Utilization Utilization 2 App servers 2 On-Demand 2 On-Demand 1 On-Demand and 1 On-Demand and 1 Reserved Medium 1 Reserved Light Utilization Utilization2 Database servers 2 On-Demand 2 Reserved 2 Reserved Medium 2 Reserved Heavy Medium Utilization Utilization Utilization
  19. 19. Example: Simple 3-Tier Web ApplicationSavings Option 1 Option 2 Option 3 Option 4 Calculator Calculator Calculator CalculatorMonthly Cost $702.72 $374.78 $256.20 $238.63One-Time Cost 1 Year Term - $1280.00 $1600.00 $1698.00 3 Year Term - $2000.00 $2500.00 $2612..60Total Cost 1 Year Term (x12) $8432.64 $5777.36 $4674.40 $4561.56 3 Year Term (x36) $25297.92 $15492.08 $11723.20 $11203.28Savings 1 Year Term n/a 32% 44% 45%(Over Option 1) 3 Year Term n/a 39% 54% 54%
  20. 20. 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)
  21. 21. 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
  22. 22. Spot Use casesUse Case Types of ApplicationsBatch 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 biologyVideo and Image Transform videos into specific formatsProcessing/RenderingTesting Provide testing of software, web sites, etcWeb/Data Crawling Analyzing data and processing itFinancial Hedgefund analytics, energy trading, etcHPC Utilize HPC servers to do embarrassingly parallel jobsCheap Compute Backend servers for Facebook games
  23. 23. Save more money by using Spot InstancesReserved Hourly Price > Spot Price < On-Demand Price
  24. 24. Typical Spot Bidding Strategies 1. Bid near the Reserved Hourly Price 2. Bid above the Spot Price History 3. Bid near On- Demand Price 4. Bid above the On-Demand Price
  25. 25. Managing Interruption
  26. 26. Architecting for Spot Instances : Best PracticesManage interruption• Split up your work into small increments• Checkpointing: Save your work frequently and periodicallyTest Your ApplicationTrack when Spot Instances Start and StopSpot Requests• Use Persistent Requests for continuous tasks• Choose maximum price for your requests
  27. 27. Optimizing Video Transcoding Workloads Free Offering Premium Offering • Optimize for reducing cost  Optimized for Faster response times • Acceptable Delay Limits  No DelaysImplementation 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
  28. 28. 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
  29. 29. 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 (SNS, SQS, SWF, SES)
  30. 30. Optimize by converting ancillary instances into services Monitoring: CloudWatch Notifications: SNS Queuing: SQS SendMail: SES Load Balancing: ELB Workflow: SWF Search: CloudSearch
  31. 31. Elastic Load BalancingSoftware LB on EC2 Elastic Load BalancingPros Pros Application-tier load Elastic and Fault-tolerant balancer Auto scaling Monitoring includedCons SPOF Cons Elasticity has to be For Internet-facing traffic implemented manually only Not as cost-effective
  32. 32. $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
  33. 33. Application ServicesSoftware on EC2 SNS, SQS, SES, SWFPros Pros Custom features Pay as you go ScalabilityCons Availability Requires an instance High performance SPOF Limited to one AZ DIY administration
  34. 34. Consumers Producer SQS queue$0.01 per10,000 Requests($0.000001 per Request) $0.08 per hour (small instance) Producer EC2 instance Consumers + software queue
  35. 35. 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 (SNS, SQS, SWF, SES) #5 Implement Caching (ElastiCache, CloudFront)
  36. 36. caching Optimize for performance and costby page caching and edge-caching static content
  37. 37. 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 (SNS, SQS, SWF, SES) #5 Implement Caching (ElastiCache, CloudFront)
  38. 38. Thank you!miward@amazon.com Twitter: @milesward

×