What makes AWS invincible? from JAWS Days 2014

54
What makes AWS invincible? Haruka Iwao, 2014/03/15

description

 

Transcript of What makes AWS invincible? from JAWS Days 2014

Page 1: What makes AWS invincible? from JAWS Days 2014

What makes AWS invincible?Haruka Iwao, 2014/03/15

Page 2: What makes AWS invincible? from JAWS Days 2014

Before talking about AWS

Page 3: What makes AWS invincible? from JAWS Days 2014

About myself

Haruka Iwao (@Yuryu) DevOps Engineer

at FreakOut, Inc.

Lived in Osaka, Tsukuba, Yokohama. Now in Tokyo.

Playing FFXIV ARR

Page 4: What makes AWS invincible? from JAWS Days 2014

Me

Final Fantasy XIV ARR Status:Cleared the Coil Turn 5.Got my Allagan Weapon.

Page 5: What makes AWS invincible? from JAWS Days 2014

Kindle Publishing

Publishing Kindle books about the Linux Kernel

Search “Yuryu Linux”

Page 6: What makes AWS invincible? from JAWS Days 2014

About FreakOut, Inc.

Not about freaking out :p Advertisement company

Established in 2010

“Real-time Bidding”

Page 7: What makes AWS invincible? from JAWS Days 2014

Real-time bidding

SSPSupply-side

Platform

DSPDemand-side

Platform

DSPDemand-side

Platform

DSPDemand-side

PlatformRequest a page

Read an ad tag

Call for bids

DSP decides the best ad for the user and page

Page 8: What makes AWS invincible? from JAWS Days 2014

Real-time bidding (2)

SSPSupply-side

Platform

DSPDemand-side

Platform

DSPDemand-side

Platform

DSPDemand-side

Platform

Bid

Auction

Return the winning ad

Page 9: What makes AWS invincible? from JAWS Days 2014

Real-time bidding (3)

http://londoncreative.com/real-time-bidding-spending-to-significantly-increase/

Page 10: What makes AWS invincible? from JAWS Days 2014

Our motto

50ms or die. Return a response within

50ms or lose an auction automatically.

Latency matters. Literally.

Page 11: What makes AWS invincible? from JAWS Days 2014

How we use AWS

Page 12: What makes AWS invincible? from JAWS Days 2014

Our system at a glance

http://aws.amazon.com/jp/solutions/case-studies/freakout/

Page 13: What makes AWS invincible? from JAWS Days 2014

Mix of on-premise and AWS

On-premise in Japan AWS in North America

Starting small Scaling well No need to visit a DC

Page 14: What makes AWS invincible? from JAWS Days 2014

Latency matters

Page 15: What makes AWS invincible? from JAWS Days 2014

Latency matters

Latency is important for our service

1ms = 1/50 of processing time

Page 16: What makes AWS invincible? from JAWS Days 2014

Latency between servers

Freedom to build an arbitrary network

... Gives you an arbitrary latency

Page 17: What makes AWS invincible? from JAWS Days 2014

Longer latency in AWS

On-premise

time=0.063 ms

time=0.083 ms

time=0.077 ms

time=0.070 ms

time=0.092 ms

time=0.069 ms

time=0.077 ms

AWS, extreme case

time=1.88 ms

time=1.96 ms

time=2.60 ms

time=3.72 ms

time=2.46 ms

time=1.05 ms

time=2.37 ms

Page 18: What makes AWS invincible? from JAWS Days 2014

Longer latency in AWS (2)

Hard to see? Let’s make a graph...

Page 19: What makes AWS invincible? from JAWS Days 2014

Longer latency, illustrated

On-premise AWS0

0.5

1

1.5

2

2.5

RTT(ms)

RTT(ms)

Page 20: What makes AWS invincible? from JAWS Days 2014

Longer latency in AWS (3)

This is not always true Just an extreme case

This applies to intra-AZ “Option” to group servers

in near racks would be great

Page 21: What makes AWS invincible? from JAWS Days 2014

Placement groups

Placement groups are not enough

Only available to cluster compute instances

Guarantees bandwidth, not latency

Page 22: What makes AWS invincible? from JAWS Days 2014

Possible workarounds

Assume the latency Design your app accordingly Use persistent connections Put hot data on local

Still, lower latency gives “extra” room

Page 23: What makes AWS invincible? from JAWS Days 2014

Infrastructure as Code

Page 24: What makes AWS invincible? from JAWS Days 2014

The “Awesome” Console

Page 25: What makes AWS invincible? from JAWS Days 2014

... So awesome to make mistakes easily...

Page 26: What makes AWS invincible? from JAWS Days 2014

AWS is Programmable.

Page 27: What makes AWS invincible? from JAWS Days 2014

Thou hast SDK.

Python

Page 28: What makes AWS invincible? from JAWS Days 2014

Thou hast CLI.

CLI

Page 29: What makes AWS invincible? from JAWS Days 2014

Thou hast CloudFormation.

AWS CloudFormation

Page 30: What makes AWS invincible? from JAWS Days 2014

SDK + CLI + CloudFormation You can “code” your

infrastructure Infrastructure becomes

“reproducible” and “reusable”

Page 31: What makes AWS invincible? from JAWS Days 2014

Always use CLI

Always use CLI to make changes “Review” the commands Less chance of “oops”

But...

Page 32: What makes AWS invincible? from JAWS Days 2014

CLI is hard to understand!

Page 33: What makes AWS invincible? from JAWS Days 2014

VS

aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type t1.micro --key-name MyKeyPair --security-group-ids sg-xxxxxxxx --subnet-id subnet-xxxxxxxx

Page 34: What makes AWS invincible? from JAWS Days 2014

Easy enough?

Page 35: What makes AWS invincible? from JAWS Days 2014

No way...

Page 36: What makes AWS invincible? from JAWS Days 2014

Record & Play

“Record” instructions on the Web Console

“Playback” them using CLI In other words...

Page 37: What makes AWS invincible? from JAWS Days 2014

Converted to

aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type t1.micro --key-name MyKeyPair --security-group-ids sg-xxxxxxxx --subnet-id subnet-xxxxxxxx

Page 38: What makes AWS invincible? from JAWS Days 2014

With “playback”

You could review changes beforehand

You could record changes and reuse them

Easier than writing CLI commands by hand

Page 39: What makes AWS invincible? from JAWS Days 2014

A very famous quote about “code”

Page 40: What makes AWS invincible? from JAWS Days 2014

All your code are belong to test

Page 41: What makes AWS invincible? from JAWS Days 2014

Testing is Important

Every program has bugs “Infrastructure as Code” is

no exception

Page 42: What makes AWS invincible? from JAWS Days 2014

How do you test?How do you

test?

Page 43: What makes AWS invincible? from JAWS Days 2014

Bugs can be fatal

A bug can destroy your whole system

What if you accidentally Terminate an instance Set a wrong route table Delete RR from Route53

Page 44: What makes AWS invincible? from JAWS Days 2014

“Sandbox” for testing

VPC is (sometimes) not enough

Test 100% bootstrap in a safe environment Register IAM accounts Add Route53 zones Set up S3 buckets, etc…

Page 45: What makes AWS invincible? from JAWS Days 2014

Framework for testing

Test-kitchen to test your Chef cookbooks

Serverspec to test your server setups

How do you verify your changes to AWS?

Page 46: What makes AWS invincible? from JAWS Days 2014

Possible workarounds

Use a separate account Maybe we need more

environments in the future? Costs money

CloudFormer converts environments to configuration

Page 47: What makes AWS invincible? from JAWS Days 2014

Scenario #1

You add a new rule to your security group aws ec2 authorize-security-

You want to make sure a port is open or closed between particular hosts How?

Page 48: What makes AWS invincible? from JAWS Days 2014

Workaround #1

Create a new VPC Apply the new rule Launch two instances Check connectivity

Page 49: What makes AWS invincible? from JAWS Days 2014

Scenario #2

You set up Route53 Health Checks

Now you want to test if it actually fails-over How?

Page 50: What makes AWS invincible? from JAWS Days 2014

Workaround #2

Set up two ELBs / instances Stop instances registered

to one ELB Query to R53 until it fails-

over

Page 51: What makes AWS invincible? from JAWS Days 2014

Need a solution!

A “common language” to verify AWS configuration

Want to run tests cheaper, quicker and safer

Even the requirements are not yet clear…

Page 52: What makes AWS invincible? from JAWS Days 2014

In the end of the presentation…

Page 53: What makes AWS invincible? from JAWS Days 2014

What makes AWS invincible? Lower latency

Giving options or hints to EC2

“Playback” feature Generate CLI commands

using simple UI

Testing methodology

Page 54: What makes AWS invincible? from JAWS Days 2014

Thank you!