the lean cloud for startups with aws - cost optimisation

55
COST OPTIMIZATION Ianni Vamvadelis Solutions Architect

Upload: amazon-web-services

Post on 16-Jan-2017

283 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: The Lean Cloud for Startups with AWS - Cost Optimisation

COST OPTIMIZATION

Ianni Vamvadelis Solutions Architect

Page 2: The Lean Cloud for Startups with AWS - Cost Optimisation

Multiple dimensions of optimization

Cost Performance Response time Time to market High-availability Scalability Security Manageability …….

Page 3: The Lean Cloud for Startups with AWS - Cost Optimisation

Elastic Capacity

Page 4: The Lean Cloud for Startups with AWS - Cost Optimisation

When you turn off your cloud resources, you actually stop paying for them

Page 5: The Lean Cloud for Startups with AWS - Cost Optimisation

6 am

Page 6: The Lean Cloud for Startups with AWS - Cost Optimisation

10 am

Page 7: The Lean Cloud for Startups with AWS - Cost Optimisation

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

We

b S

erv

ers

Hour

25% Savings

during a day

Page 8: The Lean Cloud for Startups with AWS - Cost Optimisation

Availability Zone #2

Availability Zone #1

Auto Scaling group : App Tier

Auto Scaling group : Web Tier

Elastic Load Balancer

www.MyWebSite.com (dynamic data)

media.MyWebSite.com (static content,

streaming media)

Amazon Route 53 (DNS)

Amazon EC2

Amazon RDS Amazon RDS

Amazon S3

Amazon CloudFront

Page 9: The Lean Cloud for Startups with AWS - Cost Optimisation

Auto scaling options

• Scaling base on Policy – Scale up and down base on metrics

Scaling Up policy - Double the group size if avg cpu > 80%

Scaling Down policy - Decrement by 10% if avg cpu < 30%

• Scaling by Schedule Scheduled Actions to meet known demand

Scheduled up to 31 days into the future

Recurring scheduled scaling activities.

Page 10: The Lean Cloud for Startups with AWS - Cost Optimisation

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29

Web

Serv

ers

Days of the Month

75% Savings

during a month

Page 11: The Lean Cloud for Startups with AWS - Cost Optimisation

Instance Types

Page 12: The Lean Cloud for Startups with AWS - Cost Optimisation
Page 13: The Lean Cloud for Startups with AWS - Cost Optimisation

On Demand

Page 14: The Lean Cloud for Startups with AWS - Cost Optimisation

Choosing an Instance Type

• Start with the EC2 instance type that best matches

– memory requirements

virtual cores

• Tune your instance type to optimise for cost

– No need to get it right first time

• Run across AZs

Smaller sizes => more granularity => deploy across AZs

Page 15: The Lean Cloud for Startups with AWS - Cost Optimisation

Knowing your usage

Instance

Amazon CloudWatch

Alarm

Free Memory

Free CPU Free HDD

At 1-min intervals

Custom Metrics

PUT 2 weeks

Page 16: The Lean Cloud for Startups with AWS - Cost Optimisation

Billing alerts

Dev 1

Dev 2

Test Master Account

Production

Internal Systems

Dev 1 reached $100

Dev 2 reached $250

Test reached $1,000

Prod reached $1,200

Int. reached $400

Page 17: The Lean Cloud for Startups with AWS - Cost Optimisation

Programmatic access

Dev 1

Dev 2

Test Master Account

Consolidated Billing

Data labeled by

source in S3

Production

Internal Systems

Billing Alerts

Bill reached $x

Cost accounting in

favorite package

Page 18: The Lean Cloud for Startups with AWS - Cost Optimisation

Business

Basic

Developer

Enterprise

Offering

24x7x365 ✓

Forum Access ✓

Documentation ✓

Access to support Phone, Chat,

Email

Named Contacts 5

Fastest Response Time 1 Hour

Architecture Support Use Case

Guidance

Best Practice ✓

Diagnostics Tools ✓

Direct Routing ✓

3rd Party Software ✓

Trusted Advisor ✓

Page 19: The Lean Cloud for Startups with AWS - Cost Optimisation

Business

Basic

Developer

Enterprise

Offering

24x7x365 ✓

Forum Access ✓

Documentation ✓

Access to support Phone, Chat,

Email

Named Contacts 5

Fastest Response Time 1 Hour

Architecture Support Use Case

Guidance

Best Practice ✓

Diagnostics Tools ✓

Direct Routing ✓

3rd Party Software ✓

Trusted Advisor ✓

Page 20: The Lean Cloud for Startups with AWS - Cost Optimisation
Page 21: The Lean Cloud for Startups with AWS - Cost Optimisation
Page 22: The Lean Cloud for Startups with AWS - Cost Optimisation

Horizontal Scaling and

Vertical Scaling

Page 23: The Lean Cloud for Startups with AWS - Cost Optimisation

Reserved Instances

Page 24: The Lean Cloud for Startups with AWS - Cost Optimisation

Optimize by using Reserved Instances

Heavy Utilization RI

Medium Utilization RI

Light Utilization RI

1-year and 3-year terms

On-demand Instances

• Pay as you go

• Starts from $0.02/Hour

Reserved Instances

• One time low upfront fee + lower hourly cost

• $23 for 1 year term and $0.012/Hour

Spot Instances

• Requested Bid Price and Pay as you go

• $0.005/Hour as of today at 9 AM

Page 25: The Lean Cloud for Startups with AWS - Cost Optimisation

Light Utilization RI

• 15-40% utilization

• Lower costs up to 34%

• Use Cases: Disaster Recovery, Weekly / Monthly reporting, Elastic Map Reduce

Page 26: The Lean Cloud for Startups with AWS - Cost Optimisation

Medium Utilization RI

• 41-79% utilization

• Lower costs up to 49%

• Use Cases: Web applications, many heavy processing tasks, running much of the time

Page 27: The Lean Cloud for Startups with AWS - Cost Optimisation

Heavy Utilization RI

• > 80% utilization

• Lower costs up to 58%

• Use Cases: Databases, Large Scale HPC, Always-on infrastructure, Baseline

Page 28: The Lean Cloud for Startups with AWS - Cost Optimisation

Best RI for Utilisation

$-

$2,000

$4,000

$6,000

$8,000

$10,000

$12,000

$14,000

$16,000

$18,000

Heavy

Medium

Light

O-Demand

Page 29: The Lean Cloud for Startups with AWS - Cost Optimisation

Optimizing Cost with RIs

0

2

4

6

8

10

12

14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

On Demand

Light Utilization RI

Medium Utilization RI

Heavy utilization RI

Page 30: The Lean Cloud for Startups with AWS - Cost Optimisation

http://aws.amazon.com/whitepapers

Page 31: The Lean Cloud for Startups with AWS - Cost Optimisation

Spot Instances Bid on unused Amazon EC2 capacity.

Page 32: The Lean Cloud for Startups with AWS - Cost Optimisation

Optimize by using Spot Instances

On-demand Instances

• Pay as you go

• Starts from $0.025/Hour

Reserved Instances

• One time low upfront fee + Pay as you go

• $23 for 1 year term and $0.015/Hour

Spot Instances

• Requested Bid Price and Pay as you go

• $0.005/Hour as of today at 9 AM

Page 33: The Lean Cloud for Startups with AWS - Cost Optimisation

What are Spot Instances?

Availability Zone

Region

Availability Zone

Unused

Unused

Unused

Unused

Unused

Unused

Sold at 50% Discount!

Sold at 56% Discount!

Sold at 66% Discount!

Sold at 59% Discount!

Sold at 54% Discount!

Sold at 63% Discount!

Page 34: The Lean Cloud for Startups with AWS - Cost Optimisation

What is the tradeoff?

Availability Zone

Region

Availability Zone

Unused

Unused

Unused

Unused

Unused

Unused

Reclaimed

Reclaimed

Page 35: The Lean Cloud for Startups with AWS - Cost Optimisation
Page 36: The Lean Cloud for Startups with AWS - Cost Optimisation
Page 37: The Lean Cloud for Startups with AWS - Cost Optimisation

Architecting for Spot Instances

Decouple Components Separate interactive and backend processing

Design for interruption Use SQS, SWF

data in a durable store

save progress regularly

Page 38: The Lean Cloud for Startups with AWS - Cost Optimisation

Use Cases for Spot

Analytics Financial Modelling

and Analysis

Media Encoding Geospatial Analysis

Testing Scientific Computing

Web Crawling Big Data

Page 39: The Lean Cloud for Startups with AWS - Cost Optimisation

#1: Cost without Spot 4 instances *14 hrs * $0.50 = $28 Job Flow

14 Hours

Duration:

EMR with Spot Instances

#2: Cost with Spot 4 instances *7 hrs * $0.50 = $14 +

5 instances * 7 hrs * $0.25 = $8.75

Total = $22.75

Scenario #1

Duration:

Job Flow

7 Hours

Scenario #2

Time Savings: 50%

Cost Savings: ~22%

Page 40: The Lean Cloud for Startups with AWS - Cost Optimisation

Bidding Strategies

Page 41: The Lean Cloud for Startups with AWS - Cost Optimisation

Strategy: Optimize for Cost

• Engineered application towards a cost

• Set low maximum bid price to minimize costs

• Comfortable if process takes longer or jobs were re-run

• When interrupted, no charge for that hour.

Page 42: The Lean Cloud for Startups with AWS - Cost Optimisation

$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $

Page 43: The Lean Cloud for Startups with AWS - Cost Optimisation

Strategy: Price History Momentum

• Monitor spot market price

• Bid 10% above Average Spot Price of the Last Hour

• Maximum bid of 80% of On-Demand Price

• Expect fewer interruptions than Optimize for Cost

Page 44: The Lean Cloud for Startups with AWS - Cost Optimisation

Strategy: Price History Momentum

Page 45: The Lean Cloud for Startups with AWS - Cost Optimisation

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

Page 46: The Lean Cloud for Startups with AWS - Cost Optimisation

Strategy: Discount over On-Demand

Switch to

On-Demand Switch Back

to Spot

Substantial

Savings

Much lower

costs than

On-Demand

Page 47: The Lean Cloud for Startups with AWS - Cost Optimisation

Strategy: Minimize Interruption ~57%

Savings

On Average

Substantial

Savings

Page 48: The Lean Cloud for Startups with AWS - Cost Optimisation
Page 49: The Lean Cloud for Startups with AWS - Cost Optimisation

Complementary services

Page 50: The Lean Cloud for Startups with AWS - Cost Optimisation

Web Servers

$0.085 per hour

(small instance) Availability Zone

$0.028 per hour

Web Servers

Availability Zone

EC2 instance

+ software LB

Elastic Load

Balancer DNS

DNS

Page 51: The Lean Cloud for Startups with AWS - Cost Optimisation

Producer

SQS queue

Consumers

Consumers Producer

EC2 instance

+ software queue

$0.01 per

10,000 Requests ($0.000001 per Request)

$0.085 per hour

(small instance)

Page 52: The Lean Cloud for Startups with AWS - Cost Optimisation

Software v/s Services

SNS, SQS, SES, SWF

Pros

• Pay as you go

• Scalability

• Availability

• High performance

Software on EC2

Pros

• Custom features

Cons

• Requires an instance

• SPOF

• Limited to one AZ

• DIY administration

Page 53: The Lean Cloud for Startups with AWS - Cost Optimisation

1. Elastic Capacity

2. Instance Types

3. Reserved Instances

4. Spot Instances

5. Complementary services

Page 54: The Lean Cloud for Startups with AWS - Cost Optimisation

aws.amazon.com/economics

aws.amazon.com/calculator

Next Steps:

Page 55: The Lean Cloud for Startups with AWS - Cost Optimisation