bootstrapping - session 1 - your first week with amazon ec2

83
Ryan Shuttleworth, Technical Evangelist Your first week with EC2 (and other AWS things…)

Upload: amazon-web-services

Post on 15-Jan-2015

1.934 views

Category:

Technology


1 download

DESCRIPTION

Amazon Elastic Compute Cloud (Amazon EC2) provides resizable compute capacity in the cloud and is often the starting point for your first week using AWS. This presentation will introduce some essential getting started tips and walk through the journey into AWS, the basic technologies you need to understand and why you should use them. You'll hear real a customer's first year journey and benefit from what they would tell you to do in your first week as they impart the lessons learned, challenges faced and opportunities presented. Ryan Shuttleworth, Technical Evangelist, AWS Andrew Dunn, CTO and Nick Hills, Ops Manager, Compliant Phones

TRANSCRIPT

Page 1: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Ryan Shuttleworth, Technical Evangelist

Your first week with EC2 (and other AWS things…)

Page 2: Bootstrapping - Session 1 - Your First Week with Amazon EC2

things you should know/think about up front

some best practices for getting started

essential technologies to dive into and get familiar with

architectural principles you should immerse yourself in

What are we going to cover? Your first 5 days with EC2…

Page 3: Bootstrapping - Session 1 - Your First Week with Amazon EC2

hear a ‘looking back at our first year’ customer story

compressed into 5 days

What are we going to cover? Your first 5 days with EC2…

Page 4: Bootstrapping - Session 1 - Your First Week with Amazon EC2

organise your

house 1 DAY

Page 5: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Users & Roles

Start as you mean to go on

Secure your console with IAM roles

A little time spent now will save headaches later

Page 6: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Users & Roles

Start as you mean to go on

Secure your console with IAM roles

A little time spent now will save headaches later

Accounts & Billing

Create a structure that makes sense

Dev & Test accounts vs production

Consolidated billing

Resource tagging

Page 7: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Master Account

[email protected]

Page 8: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Division B [email protected]

User2 Dev2 Admin2

IAM

Master Account

[email protected]

consolidated billing information

Page 9: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Division B [email protected]

User2 Dev2 Admin2

IAM

Tags: Own=Div Proj=P

Tags: Own=Div Proj=Q

Tags: Own=Div Proj=R

Master Account

[email protected]

consolidated billing information Tags: (key-value)

e.g Own=Div Proj=R

Page 10: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Operating Co. A [email protected]

User1 Dev1 Admin1

IAM

Tags: Own=OpCo Proj=A

Tags: Own=OpCo Proj=B

Tags: Own=OpCo Proj=C

Division B [email protected]

User2 Dev2 Admin2

IAM

Tags: Own=Div Proj=P

Tags: Own=Div Proj=Q

Tags: Own=Div Proj=R

Business Unit C [email protected]

User3 Dev3 Admin3

IAM

Tags: Own=BusC Proj=X

Tags: Own=BusC Proj=Y

Tags: Own=BusC Proj=Z

Master Account

[email protected]

consolidated billing information

Page 11: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Operating Co. A [email protected]

User1 Dev1 Admin1

IAM

Tags: Own=OpCo Proj=A

Tags: Own=OpCo Proj=B

Tags: Own=OpCo Proj=C

Division B [email protected]

User2 Dev2 Admin2

IAM

Tags: Own=Div Proj=P

Tags: Own=Div Proj=Q

Tags: Own=Div Proj=R

Business Unit C [email protected]

User3 Dev3 Admin3

IAM

Tags: Own=BusC Proj=X

Tags: Own=BusC Proj=Y

Tags: Own=BusC Proj=Z

Master Account

[email protected]

consolidated billing information

Page 12: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Master Account

[email protected]

consolidated billing information

Programmatic billing access

S3 CSV

Operating Co. A [email protected]

User1 Dev1 Admin1

IAM

Tags: Own=OpCo Proj=A

Tags: Own=OpCo Proj=B

Tags: Own=OpCo Proj=C

Division B [email protected]

User2 Dev2 Admin2

IAM

Tags: Own=Div Proj=P

Tags: Own=Div Proj=Q

Tags: Own=Div Proj=R

Business Unit C [email protected]

User3 Dev3 Admin3

IAM

Tags: Own=BusC Proj=X

Tags: Own=BusC Proj=Y

Tags: Own=BusC Proj=Z

Page 13: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Operating Co. A [email protected]

User1 Dev1 Admin1

IAM

Tags: Own=OpCo Proj=A

Tags: Own=OpCo Proj=B

Tags: Own=OpCo Proj=C

Division B [email protected]

User2 Dev2 Admin2

IAM

Tags: Own=Div Proj=P

Tags: Own=Div Proj=Q

Tags: Own=Div Proj=R

Business Unit C [email protected]

User3 Dev3 Admin3

IAM

Tags: Own=BusC Proj=X

Tags: Own=BusC Proj=Y

Tags: Own=BusC Proj=Z

Master Account

[email protected]

consolidated billing information

Programmatic billing access

S3 CSV

Page 14: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Secrets & Keys

Page 15: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Secrets & Keys

Your front door keys

Page 16: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Secrets & Keys

Your front door keys

Control access to

your instances

Key management

strategy

Page 17: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Secrets & Keys

Control access to

your APIs

Your front door keys

Use IAM Roles to

distribute to instances

Control access to

your instances

Key management

strategy

Page 18: Bootstrapping - Session 1 - Your First Week with Amazon EC2

learn the

basics 2 DAY

Page 19: Bootstrapping - Session 1 - Your First Week with Amazon EC2

What is EC2?

Elastic capacity Flexible

Complete control

Reliable

Inexpensive

Secure

Page 20: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Disposable compute

Page 21: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Instance

Page 22: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Instance Unit of scale

Unit of resilience

Unit of control

Page 23: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Instance Unit of scale

Unit of resilience

Unit of control

Your stack

Page 24: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Instance

Instance

Instance

Instance

Unit of scale

Unit of resilience

Unit of control

Scal

e o

ut

Page 25: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Instance

Instance

Instance

Instance

Unit of scale

Unit of resilience

Unit of control

Page 26: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Instance

Instance

Instance

Unit of scale

Unit of resilience

Unit of control

Page 27: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Instance

Instance

Instance

Unit of scale

Unit of resilience

Unit of control

Instance

Page 28: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Think differently Compute is transient

Page 29: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Programmatic

resources Treat your datacentre

resources like code

Page 30: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Distributed

systems

Programmatic

resources

Design for decoupled

systems up front

Treat your datacentre

resources like code

Page 31: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Late binding

Distributed

systems

Programmatic

resources

Decide what it will

run on at point of

deployment

Design for decoupled

systems up front

Treat your datacentre

resources like code

Page 32: Bootstrapping - Session 1 - Your First Week with Amazon EC2

go wild with

tools 3 DAY

Page 33: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Compute

Storage

Security Scaling

Database

Networking Monitoring

Messaging

Workflow

DNS

Load Balancing

Backup CDN

Access everything via CLI, API or

Console

Achieve the highest levels of automation

sophistication with ease

Everything is programmable

Page 34: Bootstrapping - Session 1 - Your First Week with Amazon EC2

ec2-run-instances ami-54cf5c3d

--instance-count 2

--group webservers

--key mykey

--instance-type m1.small

$>

Page 35: Bootstrapping - Session 1 - Your First Week with Amazon EC2

>>> import boto.ec2

>>> conn = boto.ec2.connect_to_region("us-east-1")

>>> conn.run_instances(

'ami-54cf5c3d',

key_name='mykey',

instance_type='m1.small',

security_groups=['webservers'])

Page 36: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Resources created programmatically

Page 37: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Resources created programmatically Configure automatically

Page 38: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Bake an AMI

Start an instance

Configure the

instance

Create an AMI from

your instance

Start new ones from

the AMI

Bootstrapping

Page 39: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Bake an AMI

Start an instance

Configure the

instance

Create an AMI from

your instance

Start new ones from

the AMI

Bootstrapping

ec2-run-instances

<your ami-id>

$>

Page 40: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Bake an AMI Configure dynamically

Start an instance

Configure the

instance

Create an AMI from

your instance

Start new ones from

the AMI

Bootstrapping

Launch an instance

Use metadata service

and cloud-init to

perform actions on

instance when it

launches

vs

Bootstrapping

Page 41: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Bake an AMI

Build your base

images and setup

custom initialisation

scripts

Maintain your ‘golden’

base

Bootstrapping

Use bootstrapping to

pass custom

information in and

perform post launch

tasks like pulling

code from SVN

+

Bootstrapping

Configure dynamically

Page 42: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Bake an AMI

Bootstrapping

Time consuming configuration

(e.g startup time)

Static configurations

(e.g less change management)

Bootstrapping

Configure dynamically

Page 43: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Bake an AMI

Bootstrapping

Continuous deployment

(e.g latest code)

Environment specific

(e.g dev-test-prod)

Bootstrapping

Configure dynamically

Page 44: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Goal is bring an instance up in a

useful state The balance will vary depending upon your

application

Page 45: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Instance

request

User data

Page 46: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Instance

request

User data

Meta-data service

Page 47: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Instance

request

User data

Instance

Meta-data service

Page 48: Bootstrapping - Session 1 - Your First Week with Amazon EC2

#!/bin/sh

yum -y install httpd php mysql php-mysql

chkconfig httpd on

/etc/init.d/httpd start

Shell script in user-data will be executed on launch:

Page 49: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Amazon Windows EC2Config Service executes user-

data on launch:

<script>dir > c:\test.log</script>

<powershell>any command that you can run</powershell>

<powershell>

Read-S3Object -BucketName myS3Bucket

-Key myFolder/myFile.zip

-File c:\destinationFile.zip

</powershell>

AWS Powershell Tools

Page 50: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Why do this?

Automation Less fingers, less mistakes

Availability Drive higher

availability with

self-healing

Security Instances

locked down by

default

Flexible Shell,

Powershell,

CloudFormation

,Chef, Puppet,

OpsWorks

Scale Manage large scale

deployments and drive

autoscaling

Efficiency Audit and manage

your estate with

less time & effort

Page 51: Bootstrapping - Session 1 - Your First Week with Amazon EC2

try something

new 4 DAY

Page 52: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Unconstrained EC2 resources

Page 53: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Unconstrained Complimentary services

Page 54: Bootstrapping - Session 1 - Your First Week with Amazon EC2

My little instance (created programmatically)

Page 55: Bootstrapping - Session 1 - Your First Week with Amazon EC2

A bit of S3 code (pulled down automatically from S3)

>>> from boto.s3.key import Key

>>> k = Key(bucket)

>>> k.key = 'foobar'

>>> k.set_contents_from_string('This is a test of S3')

My little instance (created programmatically)

Page 56: Bootstrapping - Session 1 - Your First Week with Amazon EC2

A bit of S3 code (installed automatically)

>>> from boto.s3.key import Key

>>> k = Key(bucket)

>>> k.key = 'foobar'

>>> k.set_contents_from_string('This is a test of S3')

My little instance (created programmatically)

UNLIMITED storage

from my little instance

Page 57: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Services instead of software Removes undifferentiated heavy lifting

Page 58: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Services instead of software Removes undifferentiated heavy lifting

S3 for object storage

SQS for queues

RDS for databases

CloudWatch for monitoring

Page 59: Bootstrapping - Session 1 - Your First Week with Amazon EC2

put something

together 5 DAY

Page 60: Bootstrapping - Session 1 - Your First Week with Amazon EC2

1. Use multiple

availability zones

Page 61: Bootstrapping - Session 1 - Your First Week with Amazon EC2

2. Use RDS with replicas

and slaves

Page 62: Bootstrapping - Session 1 - Your First Week with Amazon EC2

3. Use auto-scaling

groups

Page 63: Bootstrapping - Session 1 - Your First Week with Amazon EC2

4. Use Elastic Load

Balancing

Page 64: Bootstrapping - Session 1 - Your First Week with Amazon EC2

5. Use Route53 to host

DNS zones

Page 65: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Find out more about model architectures in:

Building Web Scale Applications (bootstrapping track)

Architecting for High Availability (advanced track)

Page 66: Bootstrapping - Session 1 - Your First Week with Amazon EC2

listen to Nick

and Andy’s

story

6 DAY

Page 67: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Amazon Web Services One Year, in 5 days…

Page 68: Bootstrapping - Session 1 - Your First Week with Amazon EC2

What do we do

➔ Record peoples mobile and fixed communications

– Voice, sms etc..

– Highly sensitive data

– Real time analytics and alerting

– Over 120 Financial Services organisations and other verticals

Page 69: Bootstrapping - Session 1 - Your First Week with Amazon EC2

What is Important

➔ Security

➔ Scalability

➔ Flexibility

➔ Global Platform

Page 70: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Day Zero

➔ Recently Funded

➔ Full Pipeline of customers

➔ 6 Weeks to ‘go live’

➔ Web Console Service & Storage needed asap for demos

Page 71: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Day One – I found us a Server!

One “slightly fire

damaged” server

going cheap..

Page 72: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Day One – Getting Started

Page 73: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Day One – Lessons Learnt

➔ I’m dangerous on my own – I need a SysOps Guru

➔ Elastic IPs – Elastic Load Balancers & Route53

➔ RDS Monitoring – avoid that Sunday ‘brown alert’

moment, use cloud watch

➔ Single Instances… No

– Stateless and multiple instances

➔ Decouple stuff, SQS, SWF, SNS

Page 74: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Day Two

Page 75: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Day Two – Lessons Learnt

➔ Larger Estate:

– Autoscaling

– More Logs (evidence)

– More Metrics

– More code, more services, more features.

➔ Devolve everything (where possible) to be HTTP –

easier to scale

➔ Make things stateless – accept failure as routine

Page 76: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Day Three

Availability Zone #C

Availability Zone #B

Availability Zone #A

Console ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Storage Frontend ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Storage Backend ASG

Splunk ASG

Page 77: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Day Three – Lessons Learnt

➔ No human access to live

➔ Centralized Logging

– We use Splunk, considered an employee in its own right

– Consumes CloudWatch, S3 Logs, Application logs

– Hand built alerts and filter by what is relevant

– Evidence is key to diagnosis and resolution of any issues

➔ Amazon Support – cool story! Invaluable

➔ Think Big, you have a potential global platform at your

fingertips.

Page 78: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Availability Zone #C

Availability Zone #B

Availability Zone #A

Console ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Storage Frontend ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Storage Backend ASG

Splunk ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Communications ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

API Services ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

API Services ASG

Splunk ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Audit & Reporting ASG

Amazon CloudSearch

Amazon SNS

QueueQueue

Queue

Queue

VPN Gateway

Customer Gateway

AWS Direct Connect

Amazon Route 53

Availability Zone #C

Availability Zone #B

Availability Zone #A

Console ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Storage Frontend ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Storage Backend ASG

Splunk ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Communications ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

API Services ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

API Services ASG

Splunk ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Audit & Reporting ASG

Amazon CloudSearch

Amazon SNS

QueueQueue

Queue

Queue

VPN Gateway

Customer Gateway

AWS Direct Connect

Amazon Route 53

Availability Zone #C

Availability Zone #B

Availability Zone #A

Console ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Storage Frontend ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Storage Backend ASG

Splunk ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Communications ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

API Services ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

API Services ASG

Splunk ASG

Availability Zone #C

Availability Zone #B

Availability Zone #A

Audit & Reporting ASG

Amazon CloudSearch

Amazon SNS

QueueQueue

Queue

Queue

Amazon Route 53

Day

Four

Page 79: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Day Four– Lessons Learnt

➔ Check your growth – Easy to run more than you need.

➔ Document and diagram your system – roguse instances.

➔ Use Consolidated Billing

– Separate accounts for Live & Test.

– Get it off the credit card – Invoiced Billing

➔ Use as many of the tools as you can. - Don’t re-invent

the wheel, exploit the full ecosystem.

➔ Read the blogs, announcements, examples, and talk to

the AWS SA’s

Page 80: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Day Five

➔ Check out trusted advisor

– What's your score?

➔ Leave work early!

– You have a Global fault tolerant self healing system.

– It notifies you if there is a problem, and then resolves itself.

– You can keep an eye on your logs from the Pub.

➔ On a beer mat, do your reserved instance calculations

– Buy reserved instances on Monday!

Page 81: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Lessons Learnt

➔ DevOps – tightly coupled development and systems

teams = rapid evolution

➔ Building it right (evolution) allowed us to take time out

and not be worried by failure

➔ Failure doesn't have to be all bad, if you expect it.

➔ Automation of testing, release and the deployment

process, removes the risk from human mistake.

Page 82: Bootstrapping - Session 1 - Your First Week with Amazon EC2

www.compliantphones.com

Page 83: Bootstrapping - Session 1 - Your First Week with Amazon EC2

Monitoring, auto-scaling, de-coupling

Stateless, expect failure

Lock-down live, AWS support rocks, think big!

Consolidated billing, follow the blog

Reserved instances

Summary Lessons learned…

aws.typepad.com