running lean architectures: how to optimize for cost efficiency
TRANSCRIPT
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Paul YungHead of Territory Development – Hong Kong & Taiwan
19th Jan, 2017
Running Lean ArchitecturesHow to Optimize for Cost Efficiency
ARC313
What you’ll get out of this session
• Best practices on how to lower your AWS bill• Real-world customer examples• Useful tips to get started
Pay as you go
Pay less by using more
Pay less when you reserve
Pay less when AWS grows
No up-front investment
Pay per use
How do customers lower their TCO with AWS Pricing Principles?
Analysts have shown AWS reduces cost over the long term
Source: IDC, Quantifying the Business Value of Amazon Web Services (May, 2015)
Saved 52% total cost of ownershipreduction
10’s of millions of $ saved with first 12 apps migrated to AWS
40% reduction in fixed cost of launching a software products
82% savings in initial stages of the startup versus on-premise deployment
70% lower 5 year TCO per appSource: IDC Whitepaper “ The Business Value of Amazon Web
Services Accelerates Over Time” July 2012
And we’ve heard it from our customers…
So you’re feeling pretty good moving to cloud…
Until your CFO shows up with the bill.
Even when your bill is going up?
How do you ensure that you’re realizing those benefits…
When does efficiency matter?
Oct-14 Jan-15 Apr-15 Jul-15 Oct-15 Jan-16 Apr-16 Jul-16$0
$20,000
$40,000
$60,000
$80,000
$100,000
$120,000
$140,000
0.00
0.50
1.00
1.50
2.00
2.50
Usage Total Cost Unit Cost
Develop New Products Grow Scale
Best Practice Framework for Architecting on AWS
PerformanceEnsure a system delivers maximum performance for a set of resources.
Cost OptimizationAchieve the lowest price for a workload taking into account fluctuating needs.
ReliabilityEnsuring a given system is architected to
meet operational thresholds during a specific period of time.
SecurityReview definitions and compliance best
practices.
Cost optimization is…
Going from…
Pay for what you Use
To…
Pay for what you Need
Lowering TCO Through cost optimization
On-Premises
Lift & Shift Instance Right-Sizing
Improved Elasticity
Measure, Monitor, Improve
Optimized EC2 Storage Optimization
Serverless Architecture
Managed Services
True AWS Optimized
Economic Case Improves through Optimization
Traditional TCO Comparisons
Where do you start?
The Five Pillars of Cost Optimization
Right-sizing your instances
Pick the right pricing model
Increase elasticity
Measuring, monitoring &
Improve
Match usage to storage class
Pillar 1: Right-Sizing
Right-sizing• Selecting the cheapest instance available while
meeting performance requirements
• Looking at CPU, RAM, storage, and network utilization to identify potential instances that can be downsized
• Deploy EC2 Right Sizing Solution
Rule of thumb: Right size, then reserve.(But if you’re in a pinch, reserve first and then modify later)
EC2 Right Sizing Solution
• Analyze two weeks of utilization data from CloudWatch
• Provide detailed recommendations for EC2 right sizing
• Auto deploy by CloudFormation template
• Download: Cost Optimization: EC2 Right Sizing (EC2 Right Sizing) solution Implementation Guide
• https://s3.amazonaws.com/solutions-reference/cost-optimization/latest/cost-optimization-ec2-right-sizing.pdf
EC2 Instance Growth
2007 2008 201120102009 20162013 2014 2015
3
60+
Increasing customer choice through accelerating Instance innovation
Instances Launched in 2016:
• Accelerated Computing: p2• Memory Optimized: x1.16xl• General purpose: m4.16xl
57
11 12
23
42
52
Decoupled Architecture
1 * c4.8xlarge36 x vCPU60 GB$1.848 Per Hour
2 * c4.4xlarge16 x vCPU30 GB2* $0.924 = $1.848
≈
4 * c4.2xlarge8 x vCPU15 GB4*$0.462 = $1.848
≈
8 * c4.xlarge2 x vCPU3.75 GB8*0.231 = $1.848
≈
Pillar 2: Increase Elasticity
Turn off non-production instances• Look for dev/test, non-production instances that
are running always-on and turn them off.
• Lambda + CloudWatch = Automated Scheduling*
Autoscale production• Decoupled Architecture• Use Auto Scaling to scale up and down based on
demand and usage (for example, spikes).
* https://aws.amazon.com/premiumsupport/knowledge-center/start-stop-lambda-cloudwatch/
Scaling on a Schedule Elastic LoadBalancing
Auto Scaling group
Scaling event
Scaling event
cron-like syntax for recurring scaling events
Schedule individual events (up to 135 events per group)
Set min / max / desired capacity
Elastic LoadBalancing
Scaling on a Dynamic PoliciesTrigger scaling events based on demand:- Demand is measured based on metrics- Changes in metrics can be mapped to scaling
policies
Auto Scaling group
Collect metricsAlarm fires when threshold is crossed
Auto Scaling
Scaling event is triggered
Elastic LoadBalancing
Customer Example
Monday Friday End of Vacation Season 35% saved
Automate, Automate, Automate
• AWS SDKs• AWS CLI• AWS Lambda• AWS CloudFormation• AWS OpsWorks• Netflix Janitor Monkey• Cloudlytics EC2 Scheduler• Auto Scaling
Pillar 3: Leveraging the Right Pricing ModelReserved InstancesSpot InstancesOn-Demand
On-Demand
Pay for compute capacity by the hour with no long-
term commitments
For spiky workloads, or to define needs
Reserved
Make a 1 or 3 Year Commitment and receive
a significant discount over on-demand
For committed or baseline utilization
Spot
Bid for unused capacity, charged at a Spot Price
which fluctuates based on supply and demand
For fault tolerant, time-insensitive or transient
workloads
AWS EC2 Purchasing Options
EC2 On-Demand Pricing
Short-term, Spiky and unpredictable
Low cost and flexible Develop and test
EC2 Reserved Instances Pricing
Upfront payments to reduce costs
Steady State Reserved Capacity
Reserved Instances for Always-On Instances
Payment Options• no upfront• partial upfront• all upfront
Commitment level• 1 year• 3 year• RI Marketplace
* Dependent on specific AWS service, size/type, and region
Up to 75%+ savings*(and capacity reservation)
What’s New? Introducing New Benefits to Reserved Instances
How to take advantage of Reserved Instances while maximizing flexibility?
Introducing Convertible Reserved InstancesWith a Convertible Reserved Instance, you can modify your existing reservation across:
Instance families
Instance sizes
Operating systems
Tenancy
Standard vs. convertible RIs
Standard RIMax Savings
Convertible RIMax Flexibility
Standard vs. convertible RIs
1 Year, Standard 3 Year, Convertible 3 Year, Standard
No Upfront 31%$0.164
38%$0.148 N/A
Partial Upfront 41%$0.140
47%$0.126
60%$0.096
All Upfront 42%$0.138
48%$0.124
63%$0.089
24% $0.030
28% $0.035
Price of flexibility
$306.60/yr
m4.xlarge on-demand pricing: $0.239/hr, $2,093.64/yr
Reserved Instances Best PracticesStep 1: Determine Business Priorities: • Savings, flexibility, capacity
Step 2: Reserved Instance Coverage• Cover always-on resources with standard or convertible
Reserved Instances
Step 3: Increase Reserved Instance Utilization• Known architectures: Leverage Standard Reserved
Instance flexibility to increase utilization.• Growing or changing architectures: Leverage Convertible
Reserved Instances across families, sizes, and OS.• Regional Benefit: Consolidated billing to share Reserved
Instances benefits
EC2 Spot Pricing
Users with urgent computing needs or
large amounts of additional capacity
Time or instance flexible
Experiment and/or build cost sensitive
businesses
Spot Instances
• No need commitment• Opportunity to save 80-90% cost• Price based on supply/demand• You choose your maximum price/hour• Your instance is started if the Spot price is lower• Your instance is terminated if
the Spot price is higher, with 2 minutes notice• But: You did plan for fault tolerance, didn’t you?
90% Savings!*
* Compared to On Demand price based on specific EC2 instance type, region and availability zone
Spot Rules
50% of OD
75% of OD
25% of OD
You pay the market price87% discount!
• Markets where the price of compute changes based on supply and demand • You’ll Never Pay More Than Your Bid
Consider Spot for Elastic Workloads• “39 years of drug research re-processed, using over
80,000 cores, in just 9 hours for $4,232”• “New infrastructure would have cost approximately $40
million to build”
• “Our business would not exist if it weren’t for Spot”
• “Spot let us compete with a billion dollar company in AdTech”
• “With Amazon EC2 Spot instances, we save 85–90% in costs. That, in turn, allows us to experiment with less risk"
Have a balanced meal!
Why choose just one business model?
Strike a Balance
Finding balance between pricing options
Reserved Instances
On-Demand Spot
Use a Combination of All Three!
1. Use Reserved Instances for known/steady-state workloads
2. Set-up multiple Scaling groups
3. Scale using Spot, On-Demand or both
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 240
2
4
6
8
10
/Spot In-stances
On DemandSpotReserved Instance
Pillar 4: Leveraging the Right Storage ClassBlock StorageObject Storage
Object Storage is Foundational
And it’s even easier to get data into S3
But are you optimizing your object storage?
Object Storage Classes on Amazon S3
Active data Archive dataInfrequently accessed data
Standard
Hot
Standard - Infrequent Access
Warm
Amazon Glacier
Cold
Running the Numbers: S3 or S3-IAComparing 1 PB of object storage*
1PB Monthly
S3 S3-IA Savings %
$24,117 $14,116 41%
Rule of thumb: Breakeven = 105% Retrieved per Month
Content Accessed per Month
10%
$24,117 $18,350 24%50%1PB Monthly
$24,117 $23,593 2%100%1PB Monthly
* Based on US-East Prices
Case Study: Putting it Together
A Technology Company
In three months…
A Technology Company
Doubled CPU and traffic used by its Web servers
A Technology Company
While reducing EC2 spend by 33%
$72k saving per month!
How did they do it?
Solving the growth challenge
Step 1: Right-size and update instancesm1 on demand$0.07 per ECU
c4 on demand$0.02 per ECU
The impact of right-sizing
70% reductionin unit cost
Step 2: Reserve
The impact of reservations
30% reductionIn unit cost
Putting it together
85% reductionin unit cost!
“AWS has been a great business partner for Beat as we've grown rapidly during the last year.
While the number of Beat users has grown rapidly, the total cost of
using AWS has not. Through continuous cost optimizations, the cost
per user has decreased by 97% since we
launched the service.”
-THE BEATPACKING COMPANY
Su-man Park, CEO-
Sounds pretty easy, right?
Not really.
In reality, it is very complex. • Scale• Behavioral change• Visibility• Ownership
Pillar 5: Measuring, Monitoring & Improve
Automation.
1. Identify always on instances.2. Identify instances to downsize.3. Identify warm / cold storage.4. Recommend Reserved
Instances to purchase.5. Dashboard our status.6. Report on savings.
Tools for Measuring & Monitoring
Option 1: DIYBuild your own custom dashboard
We’ve helped customers set up their own dashboards and tools.
Metric trackingsavings
Spend & metrics by account
EC2 usage by purchase option
Option 2: Use a Consulting Partner
And partners have been successful helping customers monitor, manage and save cost
• Free Cost Optimization Assessment• Consolidated Billing Discount Program• Business Support Discount Program
Option 3: AWS ToolsTrusted Advisor
AWS Trusted AdvisorHelping customers automate best practices (checks) across cost optimization, security, fault tolerance, and performance improvement
Red (action recommended)Orange (investigation recommended)Green (no problem detected)
Idle Test Instances Running in us-west-1
Automating Trusted Advisorwith AWS Lambda
AWS Trusted Advisor
AWS Lambda
Actions on AWS resources
Amazon CloudWatch
events
Notifications
http://docs.aws.amazon.com/awssupport/latest/user/cloudwatch-events-ta.html
Establish Clear Targets & Metrics
Metrics & Targets
% Instances turned off daily% of Instances Right-Sized% Always on Resources Covered by RIs% RI Utilization
What KPI makes sense for this workload?
✔ ✔ ✔
✔✘✘✘✘
Set up metrics to define success and track progress
Where to Start
Set up a Cloud Competency Center
Bring in the right tools
Use metrics to reinforce behavior
Use partners to accelerate!
Thank you!
Remember to complete your evaluations!