running lean architectures: how to optimize for cost efficiency

80
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Paul Yung Head of Territory Development – Hong Kong & Taiwan [email protected] 19 th Jan, 2017 Running Lean Architectures How to Optimize for Cost Efficiency ARC313

Upload: amazon-web-services

Post on 22-Feb-2017

459 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Running Lean Architectures: How to Optimize for Cost Efficiency

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Paul YungHead of Territory Development – Hong Kong & Taiwan

[email protected]

19th Jan, 2017

Running Lean ArchitecturesHow to Optimize for Cost Efficiency

ARC313

Page 2: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 3: Running Lean Architectures: How to Optimize for Cost Efficiency

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?

Page 4: Running Lean Architectures: How to Optimize for Cost Efficiency

Analysts have shown AWS reduces cost over the long term

Source: IDC, Quantifying the Business Value of Amazon Web Services (May, 2015)

Page 5: Running Lean Architectures: How to Optimize for Cost Efficiency

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…

Page 6: Running Lean Architectures: How to Optimize for Cost Efficiency

So you’re feeling pretty good moving to cloud…

Page 7: Running Lean Architectures: How to Optimize for Cost Efficiency

Until your CFO shows up with the bill.

Page 8: Running Lean Architectures: How to Optimize for Cost Efficiency

Even when your bill is going up?

How do you ensure that you’re realizing those benefits…

Page 9: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 10: Running Lean Architectures: How to Optimize for Cost Efficiency

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.

Page 11: Running Lean Architectures: How to Optimize for Cost Efficiency

Cost optimization is…

Going from…

Pay for what you Use

To…

Pay for what you Need

Page 12: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 13: Running Lean Architectures: How to Optimize for Cost Efficiency

Where do you start?

Page 14: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 15: Running Lean Architectures: How to Optimize for Cost Efficiency

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)

Page 16: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 17: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 18: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 19: Running Lean Architectures: How to Optimize for Cost Efficiency

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/

Page 20: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 21: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 22: Running Lean Architectures: How to Optimize for Cost Efficiency

Customer Example

Monday Friday End of Vacation Season 35% saved

Page 23: Running Lean Architectures: How to Optimize for Cost Efficiency

Automate, Automate, Automate

• AWS SDKs• AWS CLI• AWS Lambda• AWS CloudFormation• AWS OpsWorks• Netflix Janitor Monkey• Cloudlytics EC2 Scheduler• Auto Scaling

Page 24: Running Lean Architectures: How to Optimize for Cost Efficiency

Pillar 3: Leveraging the Right Pricing ModelReserved InstancesSpot InstancesOn-Demand

Page 25: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 26: Running Lean Architectures: How to Optimize for Cost Efficiency

EC2 On-Demand Pricing

Short-term, Spiky and unpredictable

Low cost and flexible Develop and test

Page 27: Running Lean Architectures: How to Optimize for Cost Efficiency

EC2 Reserved Instances Pricing

Upfront payments to reduce costs

Steady State Reserved Capacity

Page 28: Running Lean Architectures: How to Optimize for Cost Efficiency

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)

Page 29: Running Lean Architectures: How to Optimize for Cost Efficiency

What’s New? Introducing New Benefits to Reserved Instances

Page 30: Running Lean Architectures: How to Optimize for Cost Efficiency

How to take advantage of Reserved Instances while maximizing flexibility?

Page 31: Running Lean Architectures: How to Optimize for Cost Efficiency

Introducing Convertible Reserved InstancesWith a Convertible Reserved Instance, you can modify your existing reservation across:

Instance families

Instance sizes

Operating systems

Tenancy

Page 32: Running Lean Architectures: How to Optimize for Cost Efficiency

Standard vs. convertible RIs

Standard RIMax Savings

Convertible RIMax Flexibility

Page 33: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 34: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 35: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 36: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 37: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 38: Running Lean Architectures: How to Optimize for Cost Efficiency

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"

Page 39: Running Lean Architectures: How to Optimize for Cost Efficiency

Have a balanced meal!

Why choose just one business model?

Page 40: Running Lean Architectures: How to Optimize for Cost Efficiency

Strike a Balance

Finding balance between pricing options

Reserved Instances

On-Demand Spot

Page 41: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 42: Running Lean Architectures: How to Optimize for Cost Efficiency

Pillar 4: Leveraging the Right Storage ClassBlock StorageObject Storage

Page 43: Running Lean Architectures: How to Optimize for Cost Efficiency

Object Storage is Foundational

Page 44: Running Lean Architectures: How to Optimize for Cost Efficiency

And it’s even easier to get data into S3

Page 45: Running Lean Architectures: How to Optimize for Cost Efficiency

But are you optimizing your object storage?

Page 46: Running Lean Architectures: How to Optimize for Cost Efficiency

Object Storage Classes on Amazon S3

Active data Archive dataInfrequently accessed data

Standard

Hot

Standard - Infrequent Access

Warm

Amazon Glacier

Cold

Page 47: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 48: Running Lean Architectures: How to Optimize for Cost Efficiency

Case Study: Putting it Together

Page 49: Running Lean Architectures: How to Optimize for Cost Efficiency

A Technology Company

In three months…

Page 50: Running Lean Architectures: How to Optimize for Cost Efficiency

A Technology Company

Doubled CPU and traffic used by its Web servers

Page 51: Running Lean Architectures: How to Optimize for Cost Efficiency

A Technology Company

While reducing EC2 spend by 33%

$72k saving per month!

Page 52: Running Lean Architectures: How to Optimize for Cost Efficiency

How did they do it?

Page 53: Running Lean Architectures: How to Optimize for Cost Efficiency

Solving the growth challenge

Page 54: Running Lean Architectures: How to Optimize for Cost Efficiency

Step 1: Right-size and update instancesm1 on demand$0.07 per ECU

c4 on demand$0.02 per ECU

Page 55: Running Lean Architectures: How to Optimize for Cost Efficiency

The impact of right-sizing

70% reductionin unit cost

Page 56: Running Lean Architectures: How to Optimize for Cost Efficiency

Step 2: Reserve

Page 57: Running Lean Architectures: How to Optimize for Cost Efficiency

The impact of reservations

30% reductionIn unit cost

Page 58: Running Lean Architectures: How to Optimize for Cost Efficiency

Putting it together

85% reductionin unit cost!

Page 59: Running Lean Architectures: How to Optimize for Cost Efficiency
Page 60: Running Lean Architectures: How to Optimize for Cost Efficiency

“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-

Page 61: Running Lean Architectures: How to Optimize for Cost Efficiency

Sounds pretty easy, right?

Not really.

In reality, it is very complex. • Scale• Behavioral change• Visibility• Ownership

Page 62: Running Lean Architectures: How to Optimize for Cost Efficiency

Pillar 5: Measuring, Monitoring & Improve

Page 63: Running Lean Architectures: How to Optimize for Cost Efficiency

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.

Page 64: Running Lean Architectures: How to Optimize for Cost Efficiency

Tools for Measuring & Monitoring

Page 65: Running Lean Architectures: How to Optimize for Cost Efficiency

Option 1: DIYBuild your own custom dashboard

Page 66: Running Lean Architectures: How to Optimize for Cost Efficiency

We’ve helped customers set up their own dashboards and tools.

Metric trackingsavings

Spend & metrics by account

EC2 usage by purchase option

Page 67: Running Lean Architectures: How to Optimize for Cost Efficiency

Option 2: Use a Consulting Partner

Page 68: Running Lean Architectures: How to Optimize for Cost Efficiency

And partners have been successful helping customers monitor, manage and save cost

• Free Cost Optimization Assessment• Consolidated Billing Discount Program• Business Support Discount Program

Page 69: Running Lean Architectures: How to Optimize for Cost Efficiency

Option 3: AWS ToolsTrusted Advisor

Page 70: Running Lean Architectures: How to Optimize for Cost Efficiency

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)

Page 71: Running Lean Architectures: How to Optimize for Cost Efficiency
Page 72: Running Lean Architectures: How to Optimize for Cost Efficiency

Idle Test Instances Running in us-west-1

Page 73: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 74: Running Lean Architectures: How to Optimize for Cost Efficiency
Page 75: Running Lean Architectures: How to Optimize for Cost Efficiency
Page 76: Running Lean Architectures: How to Optimize for Cost Efficiency

Establish Clear Targets & Metrics

Page 77: Running Lean Architectures: How to Optimize for Cost Efficiency

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

Page 78: Running Lean Architectures: How to Optimize for Cost Efficiency

Where to Start

Set up a Cloud Competency Center

Bring in the right tools

Use metrics to reinforce behavior

Use partners to accelerate!

Page 79: Running Lean Architectures: How to Optimize for Cost Efficiency

Thank you!

Page 80: Running Lean Architectures: How to Optimize for Cost Efficiency

Remember to complete your evaluations!