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.

Advanced cost management strategies in AWS

63 views

Published on

Talk by Mani Chandrasekaran, Solution Architect at Amazon on the topic "Advanced cost management strategies in AWS"

Published in: Technology
  • Be the first to comment

Advanced cost management strategies in AWS

  1. 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. BENGALURU
  2. 2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Advanced Cost Management Strategies in AWS Mani Chandrasekaran Solutions Architect, AISPL https://www.linkedin.com/in/cmanikandan https:///twitter.com/cmani
  3. 3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. What can you do to spend less on AWS? How AWS Helps You Realise Value and Save Cost Avenues for Support
  4. 4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How AWS Helps You Realize Value and Save Cost
  5. 5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Well Architected Pillars Security: The ability to protect information, systems, and assets while delivering business value through risk assessments and mitigation strategies. Reliability: The ability of a system to recover from infrastructure or service failures, dynamically acquire computing resources to meet demand, and mitigate disruptions such as misconfigurations or transient network issues. Performance Efficiency: The ability to use computing resources efficiently to meet system requirements, and to maintain that efficiency as demand changes and technologies evolve. Cost Optimization: The ability to avoid or eliminate unneeded cost or suboptimal resources. Operational Excellence: The ability to run and monitor systems to deliver business value and continually improve supporting processes and procedures.
  6. 6. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. 90%+ of our roadmap is based on customer asks. AWS has “lots” of engineers building your requested features 1430 0 500 1000 1500 2012 2013 2014 2015 2016 2017 Significant services and features released
  7. 7. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. AWS lets you eliminate waste Before we had to peer 3-5 years into the future AWS allows you to meet demand to the second!
  8. 8. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. AWS has lowered prices for customers 67 times since 2006
  9. 9. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. AWS shares how to save cost AWS re:Invent 2016: Cost Optimizing Your Architecture: Practical Design Steps For Savings (ARC310)
  10. 10. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Data TransferReal Estate Facilities Power You pay for fewer things on AWS and gain access to Serverless technology On-premises AWS highly optimised ~90% Less Cost Networking SAN Servers Storage Hypervisor Operating System Application AWS + basic optimisation ~20-40% Less Cost EBS (Block Storage) S3 (Object Storage) EC2 (Servers) Application Serverless Application
  11. 11. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. What is it? Launch of new products 75% faster (Unilever) 60% reduced downtime (Trainline) 50%+ reduction in TCO (GE) Over 500 hours per year of server configuration time saved (Sage) Examples Infrastructure cost savings / and cost avoidance Efficiency improvement by function on a task by task basis. Improved SLA times & reducing unplanned outage. Deploy new features / applications faster and reduce errors. Typical Focus Further Cloud Benefits Cost Savings (TCO) Staff Productivity Business Agility Operational Resilience The Economic Benefits of Cloud extends well beyond cost savings and avoidance
  12. 12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What can you do to spend less?
  13. 13. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Technical Pillars of Spending Less 1. Right Size 4. Reserved Instances 2. Increase Elasticity 5. Design for Cost Efficiency 3. Spot Instances
  14. 14. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. 87% Saving 1. Right Sizing is about selecting the cheapest resource for what you need m4.4xlarge $1.72 per hr m4.large $0.215 per hr 2. Check (CPU, RAM, network, disc) 1. Migrate/provision & Run 3. Right Size 5. Save!4. Review Performance
  15. 15. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. • AWS CloudWatch (manual) • AWS Trusted Advisor (with AWS Business Support) • 3rd party paid tools (including but not limited to) • Open source tools • Cost Optimisation: EC2 Right Sizing https://aws.amazon.com/answers/account-management/cost- optimization-ec2-right-sizing/ Tools for Right Sizing and finding unused resources
  16. 16. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. 2. Elasticity can reduce non-production spend by 70% or more via scheduling Fun fact: RDS can be turned off too Save even more by automatically turning resources at night and manually turn them on in the morning
  17. 17. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. AWS Auto Scaling helps you match resources to demand 1 x 24 hours m5.2xlarge @ $0.48/hr. on Linux in Sydney = $8,294.40 / month Autoscaling 51 m5.large instances @ $0.12/hr. on Linux in Sydney = $4,406.40 / month (47% saving) Demand $
  18. 18. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. • Guide to Auto Scaling https://aws.amazon.com/documentation/autoscaling/ • AWS Instance Scheduler https://aws.amazon.com/answers/infrastructure- management/instance-scheduler/ • 3rd party paid tools (including but not limited to) Tools for Increasing Elasticity
  19. 19. Instance Scheduler Demo
  20. 20. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. 3. EC2 Spot provides heavily discounted (typically 75% up to 90%), spare compute capacity at scale Using EC2 spot is a pricing and architectural best practice and decision.
  21. 21. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Rendered on Amazon EC2 Spot Instances 0 200000 400000 600000 800000 1000000 1200000 1400000 1600000 vCPU hours OD SP
  22. 22. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Spot Instances: Use Cases Big data Containers & test/dev HPC & batch Web Services FINRA has saved up to 50% from its on-premises solution, increased elasticity/scalability, and accelerated reprocessing requests from months to days with EC2 Spot Instances Yelp runs millions of tests every day with EC2 Spot Instances. Yelp improved test result response time from 2 days to 30 minutes and has also delivered a large reduction in execution costs with Spot. TLG Aerospace saw a 75% reduction in the cost per CFD simulation with Amazon EC2 Spot Instances. They were able to pass those savings along to their customers and be more competitive. AdRoll have been able to seamlessly scale their infrastructure, better serve customers across the globe, and reduce our fixed costs by 75% and operational costs by 83%.with AWS solution, including EC2 Spot Instances
  23. 23. Example – Strike a Balance § Set your Spot price > Market < On-Demand § Will always give you the market rate at or under your bid § CloudWatch alarm on number of Spot Instances in group § GroupInServiceInstances § Scale On-Demand group if #Instances in Spot group drops below threshold On-Demand Auto Scaling group Master Node Spot Auto Scaling group Weather forecast raw data Compute Nodes
  24. 24. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. AWS CloudFormation AWS OpsWorks Amazon EMR Amazon ECS AWS Data Pipeline AWS BatchAuto Scaling Amazon EC2 Spot Integrations
  25. 25. How often Spot Instances get Interrupted ? <5% With Average Savings 80-90%
  26. 26. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. New Spot Instance Advisor ü Shows your savings over On-Demand ü Helps you select pools with the least chance of interruption https://aws.amazon.com/ec2/spot/instance-advisor/
  27. 27. Spot Instance Advisor Demo
  28. 28. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Tools for EC2 Spot • AWS EC2 Fleet & Spot Fleet • AWS Spot Block (up to 6 hrs of Spot) • Spot Instance Advisor • Spot start-stop and hibernate (feature) • 3rd party paid tools (including but not limited to) like SpotInst
  29. 29. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. 4. Reserved Instances (RIs) provide discount for commitment and are leveraged by almost all mature customers Elastic workload works well with On-demand or EC2 Spot Base workloads can be discounted through RIs. RIs provide up to 75% discount, and typically 20-40% discount for a 1 year commitment $ 1 Jan 31 Dec
  30. 30. What are Reserved Instances (RIs)? • RIs are a commitment in exchange for discount • They behave like discount coupon booklets • Each hourly RI coupon in the booklet tries to match to a running instance, if matched it provides its full discount, if not it expires • RIs are a financial construct/layer on top of your AWS infrastructure RI coupon booklet
  31. 31. Convertible RI benefits Convertible RIs allow changes in: Instance Families (e.g. m4. -> c5.) Instance sizes (e.g. .large -> .xlarge) Operating System (e.g. Linux -> Windows) Tenancy (e.g. shared -> dedicated) You can: Take advantage of newer instance types (e.g. m5) Adapt your RIs as business needs change Drastically reduce the likelihood of unused RIs Take advantage of price reductions (maintain commit $, get more instances)
  32. 32. Instance Size Flexibility reduces the need to match RI size to running instance size for Standard and Convertible RIs If: • RI is Regional • RI and Instance use is Linux/UNIX (incl. Amazon Linux, CentOS, Ubuntu), and • RI and Instance is Shared tenancy RDS size flexibility applies to MySQL, MariaDB, PostgreSQL, and Amazon Aurora database engines, as well as the “bring your own license” (BYOL) edition of the Oracle DB. m4.4xlarge (4 units) m4.2xlarge (2 units) m4.2xlarge (2 units) m4.8xlarge (8 units) One RI Can apply to more than 1 smaller instance Or part of a larger instance 4 units receive discounted RI rate
  33. 33. Cost Explorer Demo
  34. 34. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. 5. Designing for Cost Efficiency has countless methods Containerisation (staff productivity and compute utilisation) Consolidated billing (RI and volume discount benefits) AWS CloudFormation (Dev time saving) Serverless & AWS Lambda ELB to Application Load Balancer Deliver content with AWS CloudFront (lower compute and data transfer) Open source platforms & databases (reduced licensing cost) Low cost security monitoring via AWS GuardDuty Running resources in a cheaper region Static Web Hosting on S3 and using S3 Select
  35. 35. Understand Your EBS Workload Characteristics Solid State Drives (SSD) Hard Disk Drives (HDD) Volume Type Provisioned IOPS SSD (io1) General Purpose SSD (gp2) Throughput Optimized HDD (st1) Cold HDD (sc1) Description Highest-performance SSD volume designed for mission- critical applications General purpose SSD volume that balances price and performance for a wide variety of transactional workloads Low cost HDD volume designed for frequently accessed, throughput- intensive workloads Lowest cost HDD volume designed for less frequently accessed workloads Use Cases § Critical business applications that require sustained IOPS performance, or more than 10,000 IOPS or 160 MiB/s of throughput per volume § Large database workloads, such as: § MongoDB § Cassandra § Microsoft SQL Server § MySQL § PostgreSQL § Oracle § Recommended for most workloads § System boot volumes § Virtual desktops § Low-latency interactive apps § Development and test environments § Streaming workloads requiring consistent, fast throughput at a low price. § Big data § Data warehouses § Log processing § Cannot be a boot volume § Throughput-oriented storage for large volumes of data that is infrequently accessed § Scenarios where the lowest storage cost is important § Cannot be a boot volume More Expensive Cheaper
  36. 36. Use Amazon S3 Storage Tiers Take advantage of Infrequent Access (IA) § No code changes using lifecycle policies* – immediate savings § Suitable for cold data (backup, log files, etc.) with requirement for fast retrieval. Example § Our app stores 100 TB of photos § Each photo is about 10 MB § Using Standard S3, we pay $2,250 per month [US Standard Region] * Alternatively, you can directly PUT into Standard – IA by specifying STANDARD_IA in the x-amz-storage-class header.
  37. 37. Example – Activate a Policy Move data after 30 days Assume we can move 80% of the data Of which 20% is still accessed regularly < twice per month
  38. 38. S3 – IA – Result! 35% Saving Same 100 TB (20 TB Standard/80 TB IA) costs only $1,460 per month (US Standard)
  39. 39. Eliminate Your Web Server Tier How much time do you spend on maintenance? How secure is your web tier? What is your capacity planning for your web tier?
  40. 40. Example – Using S3 Static Website Hosting Not so “static”: § JavaScript (Client Side) – (includes AWS SDK) § CORS Plus: § No servers § No patching § No scaling rules
  41. 41. S3 Static Website Hosting Reference Architecture S3 bucket CloudFront distribution Web Tier Cognito Identity CloudFront logs www.example.com static.example.com Availability Zone A Availability Zone B Auto Scaling Group www.example.com static.example.com web servers web servers
  42. 42. The Cost of Using Your DB as a BLOB Store Databases (particularly RDBMSs) make poor BLOB stores! Negative in terms of performance Negative in terms of management Negative in terms of cost
  43. 43. Example – Storing Your BLOB in the RDBMS CREATE OR REPLACE TABLE user_images (userid int, imageguid char(36), image BLOB); For example Each Image = 2MB 2,049K per row 3 million rows = 5.862 TB RDS MySQL cost = $3,279.56 (US Standard) per month (multi- AZ, Standard Storage) - approx
  44. 44. Store BLOB in S3, Metadata in RDS CREATE OR REPLACE TABLE user_images (userid int, imageguid char(36), imageURL VARCHAR(1000)); Per row we now store 2K in the RDBMS 3 Million rows = 5.722 GB S3 Storage = 5.862TB = $194.94 (storage) + 3MM Puts, 3MM Gets = $212.93 (inclusive, GETs, PUTs, Storage) RDS MySQL cost = $1,663.30 (US Standard) per Month Total: $1,876.23 42% saving
  45. 45. Amazon ElastiCache Predictable Performance Decrease Database Cost Cut Load on Backend Increase Read Throughput Reduce App Latency Value of Caching
  46. 46. Amazon ElastiCache Redis Multi-AZ No Data Transfer Costs Fully Managed Enhanced Redis Engine Easy to Deploy & Use Customer Value – ElastiCache vs. Self-Managed
  47. 47. Cache for Savings Elastic Load Balancing EC2 App Instances Database Instance ElastiCache Database Writes App Reads Clients Cache Updates Database Reads Example 30,000 reads per second db.m3.large – 30,000 PIOPS – Single-AZ: $3,889.68 cache.m3.large – 30,000 GETS per second: $355.02 90% Saving!
  48. 48. DynamoDB Pick the right tool for the job Key/Value Scalable throughput Low latency Amazon Aurora More complex data/queries Scalable storage Amazon Redshift Big (complex) data Higher latency ElastiCache for Redis Key/Value In-Memory (very) low latency
  49. 49. Example - No one database to rule out all MongoDB Tracking API RTB Engine User&Stats API Tracking API RTB Engine DynamoDB Decoupled Amazon Aurora Amazon Redshift User&Stats API
  50. 50. Queues – Not Just for Decoupling SQS gives you tremendous power to decouple your architecture However, resilience is only one part of the story Use queues to manage cost
  51. 51. SQS Trigger Auto Scaling Groups Based on Revenue ApproximateAgeOfOldestMessage > 600 In our example, a single m4.large can process 1,000 images in an hour. We don’t want paid customers to wait more than 10 minutes for their result. ASG MIN 1, MAX 10, DESIRED 1 ApproximateNumberOfMessagesVisible > 1000 ASG MIN 0, MAX 1, DESIRED 0Free Queue Paid Queue Images Source mobile client Auto Scaling instances Auto Scaling instances Images Result
  52. 52. SQS Trigger Auto Scaling Groups Based on Revenue In our example, a single m4.large can process 1,000 images in an hour. We don’t want paid customers to wait more than 10 minutes for their result. For example: 2,000 TXNs 50/50 free/premium Free queue TXN cost: $0.336/1,000 = $0.000336 *One instance Paid queue TXN cost: ($0.336*6)/1,000 = $0.002016 *Six instances to meet 10 minute SLA Free Queue Paid Queue Images Source mobile client Auto Scaling instances Auto Scaling instances Images Result
  53. 53. Simplify. Less Components. Less Cost. Image Source mobile client AWS Lambda For example: Each TXN takes 3750ms Assuming largest Lambda memory size (1536 MB) @ $ 0.000002501 per 100ms Each TXN now costs $0.000937875 Premium queue TXN was $0.002016 S3 Event Lambda Result 53% saving Image Result
  54. 54. Simple to Configure
  55. 55. Can Still Use SQS To Keep Free Tier Cheap Free Queue Images Sourcemobile client Auto Scaling instances More optimization Make free tier even cheaper using EC2 Spot Instances Paid tier now gets instant response (remove the 10 minute delay/SLA) at low cost AWS Lambda Prefix- based Trigger Image Result
  56. 56. Public Subnet Availability Zone A Private Subnet Public Subnet Availability Zone B Instance A 10.1.1.11 /24 Instance C 10.1.3.33 /24 Instance B 10.1.2.22 /24 Instance D 10.1.4.44 /24 Internet Gateway (IGW) 1 GB Data x 20 Intra-AZ by Private, Public or EIP = .01/GB Elastic IP 205.x.x.27 Elastic IP 205.x.x.29 VPC 1 US-Standard Region InFrom&OutToS3=0.00/GB Amazon S3 Private Subnet How To Save Data Transfer § You may use S3 to save on data transfer between EC2 in different availability zones (AZ). § The data transfer between two EC2 in different AZ costs $0.01/GB, but S3 is free to download from any AZ. § Consider the scenario where 1 GB data is transferred 20 times from one EC2 server to another in different availability zone. It will cost $0.20/GB (20 * 0.01). § However, if you are able to upload it to S3, then you just pay for storage ($0.03 / GB / month) and the best part is that data transfer between S3 and EC2 is free. § Assuming data is deleted from S3 after a day , the S3 cost will be $0.001. 99% cost savings on that data transfer by using S3. 1 2 2 1 3 3 4 4 5 5
  57. 57. Use Gateway VPC Endpoints for S3 and DynamoDB
  58. 58. HA vs. Cost Optimization Product owners often push for cost optimization § Ignoring their availability requirements § Until something fails….. § How much is your loses if your mobile apps down per hour/day? § What will happen to your customer obsession? § Will it affect your company image in the market? FIRST availability, THEN cost!
  59. 59. HA Protection for EC2 – Auto Recovery (Free) An EC2 instance (virtual machine) is not highly available by default. At least 100% Saving EBS Volume Elastic IP1 2 § A hardware or software failure affects the EC2. § CW regular health check spots that the EC2 has failed. § CW starts the recovery of the EC2 on another EC2 host server . § A new EC2 is launched on a different EC2 host server automatically. § The new EC2 is assigned the same ID and IP address as the old EC2 and linked to the same EBS. CloudWatch (CW) 1 EC2 EC2 2 3 3 4 4 5 5 5 EC2 Host Server EC2 Host Server
  60. 60. Economical Mitigation For AZ-Level Disruption Availability Zone A Availability Zone B Availability Zone A Availability Zone B Availability Zone C Example Always maintain 12 instances even if one AZ is disrupted 24 Instances 18 Instances 25% saving
  61. 61. Spend less with good Cost Management
  62. 62. Good cost management is about getting the right people to care about spend and making saving easier Allocate spend through Tagging and a multi-account strategy Use the Cost Transparency provided by AWS and Key Performance Indicators Use Cost Tools and Automation
  63. 63. Pick the tool that provides the visibility you need Simple, Static, Small environment Complex, Dynamic, Large environment 1. Monthly AWS Invoice 2. AWS Billing console 3. AWS Cost Explorer and AWS Budgets 4. AWS Billing File Analysis, DIY dashboards, and 3rd party tools
  64. 64. © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Spending less on AWS is a lot like driving Learn how to use the pedals well, look at where you’re going (often), and self-driving cars will save a lot of effort
  65. 65. Avenues of Support
  66. 66. AWS Enterprise Support, AWS Professional Services, and AWS Partners can guide your Cost journey, contact your AWS Account Manager for more information AWS Enterprise Support https://aws.amazon.com/premiumsupport/enterprise-support/ AWS Professional Services https://aws.amazon.com/professional-services/ AWS Partner Network https://aws.amazon.com/partners/
  67. 67. Next steps ..
  68. 68. Suggested next steps 1. Get your teams to use Cost Explorer to understand where you are spending 2. Pick 1 technical lever of optimisation covered today, set up a KPI to measure it, and improve it over time. (e.g. resource scheduling / on-off) 3. Come to a future AWS event about Cost to find out more about tools, methods, and discuss the topic with other customers
  69. 69. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank YOU !! Mani Chandrasekaran Solutions Architect, AISPL https://www.linkedin.com/in/cmanikandan https:///twitter.com/cmani

×