Cost Optimisation in the AWS Cloud, Ianni Vamvadelis, Solutions Architect, AWS

Post on 16-Jan-2017

350 views 3 download

Transcript of Cost Optimisation in the AWS Cloud, Ianni Vamvadelis, Solutions Architect, AWS

COST OPTIMIZATION

Ianni Vamvadelis Solutions Architect

Multiple dimensions of optimization

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

Elastic Capacity

Elasticity is a fundamental property of the cloud that drives many of its economic benefits

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

6 am

10 am

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

Web

Serv

ers

Hour

25% Savings

during a day

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

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.

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

Instance Types

On Demand

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 give more granularity for deploying across AZs

Knowing your usage

Instance

Amazon CloudWatch Alarm

Free Memory

Free CPU

Free HDD

At 1-min

intervals

Custom Metrics

PUT 2 weeks

Horizontal Scaling

and

Vertical Scaling

Reserved Instances

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.025/Hour

Reserved Instances

• One time low upfront fee + lower hourly cost

• $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

Light Utilization RI

15-40% utilization

Lower costs up to 34%

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

Medium Utilization RI

41-79% utilization

Lower costs up to 49%

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

Heavy Utilization RI

> 80% utilization

Lower costs up to 58%

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

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

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

http://aws.amazon.com/whitepapers

Spot Instances Bid on unused Amazon EC2 capacity.

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

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!

What is the tradeoff?

Availability Zone

Region

Availability Zone

Unused

Unused

Unused

Unused

Unused

Unused

Reclaimed

Reclaimed

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

Use Cases for Spot

Analytics Financial Modelling

and Analysis

Media Encoding Geospatial Analysis

Testing Scientific Computing

Web Crawling Big Data

#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%

Bidding Strategies

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.

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

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

Strategy: Price History Momentum

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

Strategy: Discount over On-Demand

Switch to

On-Demand Switch Back

to Spot

Substantial

Savings

Much lower

costs than

On-Demand

Strategy: Minimize Interruption

~57%

Savings

On Average

Substantial

Savings

Complementary

services

Web Servers

$0.095 per hour

(small instance)

Availability Zone

$0.028 per hour

Web Servers

Availability Zone

EC2 instance

+ software LB

Elastic Load

Balancer DNS

DNS

Producer

SQS queue

Consumers

Consumers

Producer

EC2 instance

+ software queue

$0.01 per

10,000 Requests ($0.000001 per Request)

$0.095 per hour

(small instance)

Software v/s Services

SNS, SQS, SES

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

1. Elastic Capacity

2. Instance Types

3. Reserved Instances

4. Spot Instances

5. Complementary services

aws.amazon.com/economics

aws.amazon.com/calculator

Next Steps:

THANK YOU