68
Berlin

AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Berlin

Page 2: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Running Lean and Mean

Designing Cost-Effective Architectures on AWS

Constantin Gonzalez

Principal Solutions Architect, AWS Germany

Page 3: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

What you’ll get out of this session

• A lower AWS bill

• A more scalable, robust, dynamic architecture

• More time to innovate

• Real-world customer examples

• Easy to implement

Page 4: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Cloud computing benefits• Pay as you go, no up-front investments

• Low ongoing cost

• Flexible capacity

• Speed, agility, and innovation

• Focus on your business

• Go global in minutes

Page 5: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Cloud computing benefits• Pay as you go, no up-front investments

• Low ongoing cost

• Flexible capacity

• Speed, agility, and innovation

• Focus on your business

• Go global in minutes

Page 6: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Optimizing for Cost

Page 7: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Strategy 1: Do nothing

Page 8: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

AWS pricing philosophyEcosystem

Global Footprint

New Features

New Services

More AWS

Usage

More

Infrastructure

Lower

Infrastructure

Costs

Reduced

Prices

More

CustomersInfrastructure

Innovation

48 price

reductions

since 2006Economies

of Scale

Page 9: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Strategy 2:

Do almost nothing

Page 10: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

AWS Trusted Advisoraws.amazon.com/premiumsupport/trustedadvisor/

Free with Business or Enterprise Support

Page 11: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Strategy 3:

Optimize Architecture

Page 12: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

The basic process

Page 13: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Architecting for low cost

Page 14: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

1: Turn off unused instances

Page 15: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

1: Turn off unused instances

• Developer, test, training instances

• Use simple instance start and stop

• Or tear down and build up all together

• Instances are disposable

• Automate, automate, automate:– AWS CloudFormation

– Weekend/off-hours scripts

– Use tags

Page 16: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Customer dev/test example

Monday Friday End of Vacation Season35% saved

Page 17: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

2: Use Auto Scaling

Page 18: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Auto Scaling

Page 19: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

AWS CloudFormation: Launch Configuration

"LaunchConfig": {

"Type" : "AWS::AutoScaling::LaunchConfiguration",

"Metadata" : {

"AWS::CloudFormation::Init" : {

"config" : {

… packages, sources, files, services …

}

}

},

"Properties": {

"ImageId" : "ami-149f7863",

"InstanceType" : "m1.small",

"SecurityGroups" : [ {"Ref" : "WebServerSecurityGroup"} ],

"KeyName" : "MySSHKey",

"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [

"#!/bin/bash -v\n",

… your user data script …

]]}}

}

}

Page 20: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

AWS CloudFormation: Auto Scaling group

"WebServerGroup" : {

"Type" : "AWS::AutoScaling::AutoScalingGroup",

"Properties" : {

"AvailabilityZones" : [

"us-east-1a","us-east-1b","us-east-1c",

],

"LaunchConfigurationName" : { "Ref" : "LaunchConfig" },

"MinSize" : “3",

"MaxSize" : “6",

"DesiredCapacity" : “3",

"LoadBalancerNames" : [ { "Ref" : "ElasticLoadBalancer" } ]

}

}

Page 21: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Align your resources with demand

Page 22: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

3: Use Reserved Instances

Page 23: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

3: Use Reserved Instances

1y RI

Break even

3y RI

Break even

Page 24: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Reserved Instances are flexible

• Can be moved between AZs

• Can be moved between EC2-

Classic and EC2-VPC platforms

• Size can be modified within the

same instance family

Page 25: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Track Savings over Time

Page 26: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Who am I• Markus Ostertag• Head of Development @ Team Internet• Online-/Tech-Business > 15 years• AWS customer since 2008• Co-Organizer AWS Usergroup Munich

Page 27: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Team Internet

Page 28: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Team Internet

Page 29: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Team Internet

Page 30: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Team Internet

Page 31: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Team Internet

Page 32: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Team Internet

Page 33: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Team Internet @ AWS• We try to

– leverage everything– be as efficient as possible– find creative solutions to roadblocks– save money whenever possible

Page 34: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

EC2• > 100 Reserved Instances• Nearly no need to scale down

• Bare metal in co-location or own computing center?

Page 35: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

EC2• Need to scale up quickly• Transparent redundancy (AZ)• Networking (VPC, Firewalls, Routing)• Traffic costs• Bandwidth per AZ

Page 36: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Services – “I can do that by myself!”• Know-How• Development (Improvement, Bugfixing)• High Availability• Operations (24/7)

Page 37: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Additional Features of AWS• Get features for free:

– API, SDKs, CLI– Global footprint (low latency)– Monitoring (Cloudwatch)– IAM– High Availability

Page 38: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Flexibility – we need it!• Testing, Staging...• Find (hardware) bottlenecks• Add technologies to our stack

• Try out new/crazy ideas and save money if they really work!

Page 39: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

MongoDB vs. DynamoDB• MongoDB-Cluster:

– >5 TB– >300 GB every day– rotate DB every week (~2 TB)

Page 40: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

MongoDB vs. DynamoDB• Several issues with MongoDB

– MongoDB updates = adventure– Maintenance sometimes difficult and time consuming– More data = more trouble

Page 41: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

MongoDB vs. DynamoDB• DynamoDB:

– Managed = no maintenance– Updates = not our/no problem– More data = not our/no problem

Page 42: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

MongoDB vs. DynamoDB• DynamoDB as a replacement

– Rotate Table/DB every day (scripted)– Automatic scaling = save money– Lower/more stable response times (< 5ms)

Page 43: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Why no actual numbers?• We don‘t compare apples to oranges • We choose a philosophy: static (bare-metal) vs. flexible (cloud), depending on

the use-case• We reduce costs in the cloud as much as possible but stick to our decision

Page 44: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure
Page 45: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

• Mail: [email protected]• Xing: http://xing.to/mo• Linkedin: http://de.linkedin.com/in/ostertag

Page 46: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

4: Use Spot Instances

Page 47: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Spot Instance rules

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

Page 48: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Spot Instance example

On-Demand:

$0.24

$0.028 (11.7%) $0.026 (10,8%)

$3.28

(1367%)

Page 49: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Spot Instances recap• Very dynamic pricing

• Opportunity to save 80-90% cost– But there are risks

• Different prices per AZ

• Leverage Auto Scaling!– One group with Spot Instances

– One group with On-Demand

– Get the best of both worlds

• New: Spot fleets – Manage thousands

of Spot Instance with one API call

Page 50: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

5: Use Amazon S3 storage classes

• Reduced redundancy storage class– 99.99% durability vs. 99.999999999%

– Up to 20% savings

– Everything that is easy to reproduce

– Use Amazon SNS lost object notifications

• Amazon Glacier storage class– Same 99.999999999% durability

– 3 to 5 hours restore time

– Up to 64% savings

– Archiving, long-term backups, and old data

• Use life-cycle rules

Page 51: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

6. Optimize Amazon DynamoDB

capacity units

• Read/write capacity units (CUs) determine

most of DynamoDB cost

• By optimizing CUs, you can save a lot of money

• But:– Need to provision enough capacity to not run into capacity errors

– Need to prepare for peaks

– Need to constantly monitor/adjust

Page 52: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

• Use caching to save read capacity units– Local RAM caches at app server instances

– Check out Amazon ElastiCache

• Think of strategies for optimizing CU use– Use multiple tables to support varied access patterns

– Understand access patterns for time series data

– Compress large attribute values

• Use Amazon SQS to buffer over-capacity writes

Page 53: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Amazon SQS can buffer requests

Page 54: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Dynamic DynamoDB

Page 55: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

DynamoDB optimization example

Caching/Optimization:

80% saved

Cache

flush

Dynamic

DynamoDB:

20% saved

Growth +

new features

Page 56: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

7. Offload your architecture

• The more you can offload, the less

infrastructure you need to maintain, scale,

and pay for

• Three easy ways to offload:– Use Amazon CloudFront

– Introduce caching

– Leverage existing Amazon web services

Page 57: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Offload popular traffic to

Amazon S3 and CloudFront

Page 58: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Offload databases through caching

Page 59: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Leverage existing services• Amazon RDS, Amazon DynamoDB or Amazon

ElastiCache for Redis, Amazon Redshift– Instead of running your own database

• Amazon CloudSearch– Instead of running your own search engine

• Amazon Elastic Transcoder

• Amazon Elastic MapReduce

• Amazon Cognito, Amazon SQS, Amazon SNS,

Amazon Simple Workflow Service, Amazon SES,

Amazon Kinesis, and more …

Simple, more reliable, lower cost

Page 60: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Cost monitoring

&

analysis

Page 61: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

AWS TCO calculator

Page 62: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

AWS simple monthly calculator

Page 63: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

AWS Billing Console

Page 64: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

AWS Cost Explorer

Page 65: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

AWS billing alerts

Page 66: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Let’s recap

1. Turn off unused instances

2. Use Auto Scaling

3. Use Reserved Instances

4. Use Spot Instances

5. Leverage Amazon S3 storage classes

6. Optimize Amazon DynamoDB capacity units

7. Offload your architecture

Page 67: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

… and remember to iterate!

Page 68: AWS Deck Templateaws-de-media.s3.amazonaws.com/images/AWS Summit Berlin... · 2015-06-24 · More AWS Usage More Infrastructure Lower Infrastructure Costs Reduced Prices More Infrastructure

Constantin Gonzalez

[email protected]

@zalez