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

AWS Summit Berlin 2013 - Your first week with EC2

Embed Size (px)

Citation preview

Page 1: AWS Summit Berlin 2013 - Your first week with EC2

Ryan Shuttleworth, Technical Evangelist

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

Page 2: AWS Summit Berlin 2013 - Your first week with 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: AWS Summit Berlin 2013 - Your first week with EC2

hear a ‘looking back at our first year’ customer storycompressed into 5 days

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

Page 4: AWS Summit Berlin 2013 - Your first week with EC2

organise your house1DAY

Page 5: AWS Summit Berlin 2013 - Your first week with 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: AWS Summit Berlin 2013 - Your first week with 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: AWS Summit Berlin 2013 - Your first week with EC2

Master [email protected]

Billing

Page 8: AWS Summit Berlin 2013 - Your first week with EC2

Division [email protected]

User2Dev2Admin2

IAM

Master [email protected]

consolidated billing information

Billing

Page 9: AWS Summit Berlin 2013 - Your first week with EC2

Division [email protected]

User2Dev2Admin2

IAM

Tags:Own=DivProj=P

Tags:Own=DivProj=Q

Tags:Own=DivProj=R

Master [email protected]

consolidated billing information

Billing

Tags: (key-value)

e.g Own=DivProj=R

Page 10: AWS Summit Berlin 2013 - Your first week with EC2

Operating Co. [email protected]

User1Dev1Admin1

IAM

Tags:Own=OpCoProj=A

Tags:Own=OpCoProj=B

Tags:Own=OpCoProj=C

Division [email protected]

User2Dev2Admin2

IAM

Tags:Own=DivProj=P

Tags:Own=DivProj=Q

Tags:Own=DivProj=R

Business Unit [email protected]

User3Dev3Admin3

IAM

Tags:Own=BusCProj=X

Tags:Own=BusCProj=Y

Tags:Own=BusCProj=Z

Master [email protected]

consolidated billing information

Billing

Page 11: AWS Summit Berlin 2013 - Your first week with EC2

Operating Co. [email protected]

User1Dev1Admin1

IAM

Tags:Own=OpCoProj=A

Tags:Own=OpCoProj=B

Tags:Own=OpCoProj=C

Division [email protected]

User2Dev2Admin2

IAM

Tags:Own=DivProj=P

Tags:Own=DivProj=Q

Tags:Own=DivProj=R

Business Unit [email protected]

User3Dev3Admin3

IAM

Tags:Own=BusCProj=X

Tags:Own=BusCProj=Y

Tags:Own=BusCProj=Z

Master [email protected]

Alert:

Reached $1,250consolidated billing information

Billing

Alert:

Reached $3,000Alert:

Reached $500

Page 12: AWS Summit Berlin 2013 - Your first week with EC2

Master [email protected]

consolidated billing information

Programmatic billing access

S3 CSV

Billing

Operating Co. [email protected]

User1Dev1Admin1

IAM

Tags:Own=OpCoProj=A

Tags:Own=OpCoProj=B

Tags:Own=OpCoProj=C

Division [email protected]

User2Dev2Admin2

IAM

Tags:Own=DivProj=P

Tags:Own=DivProj=Q

Tags:Own=DivProj=R

Business Unit [email protected]

User3Dev3Admin3

IAM

Tags:Own=BusCProj=X

Tags:Own=BusCProj=Y

Tags:Own=BusCProj=Z

Page 13: AWS Summit Berlin 2013 - Your first week with EC2

Operating Co. [email protected]

User1Dev1Admin1

IAM

Tags:Own=OpCoProj=A

Tags:Own=OpCoProj=B

Tags:Own=OpCoProj=C

Division [email protected]

User2Dev2Admin2

IAM

Tags:Own=DivProj=P

Tags:Own=DivProj=Q

Tags:Own=DivProj=R

Business Unit [email protected]

User3Dev3Admin3

IAM

Tags:Own=BusCProj=X

Tags:Own=BusCProj=Y

Tags:Own=BusCProj=Z

Master [email protected]

consolidated billing information

Programmatic billing access

S3 CSV

Billing

Page 14: AWS Summit Berlin 2013 - Your first week with EC2

Secrets & Keys

Page 15: AWS Summit Berlin 2013 - Your first week with EC2

Secrets & Keys

Your front door keys

Page 16: AWS Summit Berlin 2013 - Your first week with EC2

Secrets & Keys

Your front door keys

Control access to your instances

Key management strategy

Page 17: AWS Summit Berlin 2013 - Your first week with 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: AWS Summit Berlin 2013 - Your first week with EC2

learn the basics2DAY

Page 19: AWS Summit Berlin 2013 - Your first week with EC2

What is EC2?

Elastic capacity Flexible

Complete control

Reliable

Inexpensive

Secure

Page 20: AWS Summit Berlin 2013 - Your first week with EC2

Disposable compute

Page 21: AWS Summit Berlin 2013 - Your first week with EC2

Instance

Page 22: AWS Summit Berlin 2013 - Your first week with EC2

Instance Unit of scale

Unit of resilience

Unit of control

Page 23: AWS Summit Berlin 2013 - Your first week with EC2

Instance Unit of scale

Unit of resilience

Unit of control

Your stack

Page 24: AWS Summit Berlin 2013 - Your first week with EC2

Instance

Instance

Instance

Instance

Unit of scale

Unit of resilience

Unit of control

Scal

e ou

t

Page 25: AWS Summit Berlin 2013 - Your first week with EC2

Instance

Instance

Instance

Instance

Unit of scale

Unit of resilience

Unit of control

Page 26: AWS Summit Berlin 2013 - Your first week with EC2

Instance

Instance

Instance

Unit of scale

Unit of resilience

Unit of control

Page 27: AWS Summit Berlin 2013 - Your first week with EC2

Instance

Instance

Instance

Unit of scale

Unit of resilience

Unit of control

Instance

Page 28: AWS Summit Berlin 2013 - Your first week with EC2

Think differentlyCompute is transient

Page 29: AWS Summit Berlin 2013 - Your first week with EC2

Programmatic resources

Treat your datacentre resources like code

Page 30: AWS Summit Berlin 2013 - Your first week with EC2

Distributed systems

Programmatic resources

Design for decoupled systems up front

Treat your datacentre resources like code

Page 31: AWS Summit Berlin 2013 - Your first week with 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: AWS Summit Berlin 2013 - Your first week with EC2

go wild with tools3DAY

Page 33: AWS Summit Berlin 2013 - Your first week with EC2

Compute

Storage

Security Scaling

Database

NetworkingMonitoring

Messaging

Workflow

DNSLoad Balancing

BackupCDN

APIAccess everything

via CLI, API or Console

Achieve the highest levels of automation

sophistication with ease

Everything is programmable

Page 34: AWS Summit Berlin 2013 - Your first week with EC2

CLI Tools

ec2-run-instances ami-54cf5c3d--instance-count 2--group webservers--key mykey--instance-type m1.small

$>

Page 35: AWS Summit Berlin 2013 - Your first week with 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'])

Python boto

Page 36: AWS Summit Berlin 2013 - Your first week with EC2

Resources created programmatically

Page 37: AWS Summit Berlin 2013 - Your first week with EC2

Resources created programmaticallyConfigure automatically

Page 38: AWS Summit Berlin 2013 - Your first week with 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: AWS Summit Berlin 2013 - Your first week with 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: AWS Summit Berlin 2013 - Your first week with 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: AWS Summit Berlin 2013 - Your first week with 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: AWS Summit Berlin 2013 - Your first week with EC2

Bake an AMI

Bootstrapping

Time consuming configuration (e.g startup time)

Static configurations(e.g less change management)

Bootstrapping

Configure dynamically

Page 43: AWS Summit Berlin 2013 - Your first week with EC2

Bake an AMI

Bootstrapping

Continuous deployment(e.g latest code)

Environment specific(e.g dev-test-prod)

Bootstrapping

Configure dynamically

Page 44: AWS Summit Berlin 2013 - Your first week with EC2

Goal is bring an instance up in a useful state

The balance will vary depending upon your application

Page 45: AWS Summit Berlin 2013 - Your first week with EC2

Instance request

User data

User-data

Page 46: AWS Summit Berlin 2013 - Your first week with EC2

Instance request

User data

Meta-data service

User-data

Page 47: AWS Summit Berlin 2013 - Your first week with EC2

Instance request

User data

Instance

Meta-data service

User-data

Page 48: AWS Summit Berlin 2013 - Your first week with EC2

#!/bin/shyum -y install httpd php mysql php-mysqlchkconfig httpd on/etc/init.d/httpd start

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

Tip

Page 49: AWS Summit Berlin 2013 - Your first week with EC2

Tip

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: AWS Summit Berlin 2013 - Your first week with EC2

Why do this?

AutomationLess fingers, less mistakes

AvailabilityDrive higher

availability with self-healing

SecurityInstances

locked down by default

FlexibleShell,

Powershell, CloudFormation,Chef, Puppet,

OpsWorks

ScaleManage large scale

deployments and drive autoscaling

EfficiencyAudit and manage your estate with less time & effort

Page 51: AWS Summit Berlin 2013 - Your first week with EC2

try something new4DAY

Page 52: AWS Summit Berlin 2013 - Your first week with EC2

UnconstrainedEC2 resources

Page 53: AWS Summit Berlin 2013 - Your first week with EC2

UnconstrainedComplimentary services

Page 54: AWS Summit Berlin 2013 - Your first week with EC2

My little instance(created programmatically)

Page 55: AWS Summit Berlin 2013 - Your first week with 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: AWS Summit Berlin 2013 - Your first week with 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: AWS Summit Berlin 2013 - Your first week with EC2

Services instead of softwareRemoves undifferentiated heavy lifting

Page 58: AWS Summit Berlin 2013 - Your first week with EC2

Services instead of softwareRemoves undifferentiated heavy lifting

S3 for object storage

SQS for queues

RDS for databases

CloudWatch for monitoring

Page 59: AWS Summit Berlin 2013 - Your first week with EC2

put something together5DAY

Page 60: AWS Summit Berlin 2013 - Your first week with EC2

1. Use multiple availability zones

Page 61: AWS Summit Berlin 2013 - Your first week with EC2

2. Use RDS with replicas and slaves

Page 62: AWS Summit Berlin 2013 - Your first week with EC2

3. Use auto-scaling groups

Page 63: AWS Summit Berlin 2013 - Your first week with EC2

4. Use Elastic Load Balancing

Page 64: AWS Summit Berlin 2013 - Your first week with EC2

5. Use Route53 to host DNS zones

Page 65: AWS Summit Berlin 2013 - Your first week with EC2

Find out more about model architectures in:

Building Web Scale Applications session

Page 66: AWS Summit Berlin 2013 - Your first week with EC2

Get set up right from the start

Understand programmable compute

Use the tools and have a play

Explore the services beyond EC2

Build something! (you can always throw it away)

SummaryLessons learned…

aws.typepad.com

Page 67: AWS Summit Berlin 2013 - Your first week with EC2

Thank you