AWS intro

42
AWS introduction Michael Haberman Freelancer

Transcript of AWS intro

Page 1: AWS intro

AWS introductionMichael Haberman

Freelancer

Page 2: AWS intro

What we are going to do?

An application Scenario

Before cloud solution

How cloud can help us?

Page 3: AWS intro

Every cloud talk must start withWhy use cloud?

Page 4: AWS intro

Before cloud solutions

Page 5: AWS intro

Registration system

We offer registration infrastructure

That must be highly scalable

The infrastructure has very high load picks

Page 6: AWS intro

Registration systemFlow:

user authenticates

user send a registration request (once an hour)

application saves it

someone manually accept / reject the request

email is sent

in case of accept - allow print of confirmation (auto generated image)

Page 7: AWS intro

Solution Architecture

Clients

Web Service

Scale?

Page 8: AWS intro

Solution Architecture

Clients

Web Service

Web Service

How to balance

the load?

Page 9: AWS intro

Solution Architecture

Clients

Web Service

Web Service

How to continue scaling?

Load balancer

What happens when the service is

over loading?

Page 10: AWS intro

Solution Architecture

Clients

Web Service

Web Service

Which machine?

Queue

Who should send

emails?

DB?

Page 11: AWS intro

Solution Architecture

Clients

Web Service

Web Service

Queue

DB Single DB?

Which machine?

Maybe we need

some cache?

Where to store the images?

Page 12: AWS intro

Registration system

New requirement:

support Mobile push notification

Page 13: AWS intro

How does cloud help us?

Page 14: AWS intro

FeaturesCompute

Storage

Databases

Networking

Mobile support (SNS)

Security

Application Services (Queue, emails, etc…)

Developer Tools (Git, CI)

Management Tools

Analytics

Enterprise Applications

Page 15: AWS intro

Let’s see the AWS Console

Page 16: AWS intro

Cloud Solution

Clients

Web Service

Web Service

Queue

DB

Open Issues:DB

(replication)Push

notificationImagesCacheSend Emails

Page 17: AWS intro

Choosing Database(SQL)

First thought:

EC2 - with a DB Instance

What benefit do we gain by using a cloud base server with DB Instance on it?

Page 18: AWS intro

Choosing Database(SQL)

EC2 - might not be the first choose for DB

You pay for compute, storage, ram and etc…

Storage is expensive

You have to maintain the DB

Taking responsibility on backups

You have an entire machine only to get a connection string

Page 19: AWS intro

Choosing Database(SQL)

RDS - Rational Database Services

All you get is a connection string

Auto maintenance

Auto backups

Replication support

Paying for storage (only what you use vs EC2)

Auto address swap in case of failure

Page 20: AWS intro

DynamoDBSolution for noSQL databases

Page 21: AWS intro

Cloud Solution

Clients

Web Service

Web Service

Queue

RDS

Open Issues:DB

(replication)Push notificationImagesCacheSend Emails

Auto Scale?

Load balanc

e?

Page 22: AWS intro

EC2 - Auto ScaleDefine a threshold using CloudWatch

Add instance when event occur

Remove instance when event occur

Define min/max/desired amount of instances

Register for notification (load tests…)

Page 23: AWS intro

EC2 - Load Balancer

The Auto Scale will create instances upon high loads

The Load Balancer will keep an equal load in the instances

very easy to define

Page 24: AWS intro

Cloud Solution

Clients

EC2 EC2

Queue

RDS

Open Issues:DB

(replication)Push notificationImagesCacheSend Emails

Load Balancer + Auto Scale

Page 25: AWS intro

ElasticCacheFew EC2 instance may require high speed data sharing

Distributed cache would solve that

A key value pair

Expiration is supported (once an hour)

When new instance is created - state is easily preserved

Page 26: AWS intro

ElasticCachevar params = {

ResourceName: 'STRING_VALUE', /* required */

Tags: [ /* required */

{

Key: 'STRING_VALUE',

Value: 'STRING_VALUE'

},]};

elasticache.addTagsToResource(params, function(err, data) {

});

Page 27: AWS intro

Cloud Solution

Clients

EC2 EC2

Queue

RDS

Open Issues:DB

(replication)Push notificationImagesCacheSend Emails

Load Balancer + Auto Scale

Cloud Front

Page 28: AWS intro

SQS - Simple Queue Service

Pay as you go

No need for dedicated machine

Simple API

Dead letter queue support

Page 29: AWS intro

SQS - Enqueuevar params = {

MessageBody: 'STRING_VALUE', /* required */

QueueUrl: 'STRING_VALUE', /* required */

MessageAttributes: {

someKey: {

DataType: 'STRING_VALUE', /* required */

StringValue: 'STRING_VALUE'

},}} ;

sqs.sendMessage(params, function(err, data) {

});

Page 30: AWS intro

SQS - Dequeuevar params = {

QueueUrl: 'STRING_VALUE', /* required */

NumberOfMessages: 0,

VisibilityTimeout: 0,

WaitTimeSeconds: 0

};

sqs.receiveMessage(params, function(err, data) {

});

Page 31: AWS intro

Security!

Page 32: AWS intro

Cloud Solution

Clients

EC2 EC2

SQS

RDS

Open Issues:DB

(replication)Push notificationImagesCacheSend Emails

Load Balancer + Auto Scale

Cloud Front

Page 33: AWS intro

Cloud Storage Solutions

EC2

high cost

better performance when in the same machine

S3

low cost

distributed between different services

Glacier

low performance - archive Which one would you

use?

Page 34: AWS intro

S3S3

Separated into buckets

Each item can be up to 5 terabyte

Support event notification (upon item add send email)

Encryption support

Page 35: AWS intro

S3 - SDKvar params = {

Bucket: 'STRING_VALUE', /* required */

Key: 'STRING_VALUE', /* required */

Body: new Buffer('...') || 'STRING_VALUE' || streamObject,

Expires: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,

Metadata: {

someKey: 'STRING_VALUE',

}};

s3.putObject(params, function(err, data) {

});

Page 36: AWS intro

Cloud Solution

Clients

EC2 EC2

SQS

RDS

Open Issues:DB

(replication)Push notificationImagesCacheSend Emails

Load Balancer + Auto Scale

Cloud Front

S3

Page 37: AWS intro

Event notification

S3

upon change use SNS, SQS, Lambda events

in our example, send an email. How?

Page 38: AWS intro

Lamba events

S3

upon change use SNS, SQS, Lambda events

in our example, send an email. How?

Page 39: AWS intro

Cloud Solution

Clients

EC2 EC2

SQS

RDS

Open Issues:DB (replication)Push

notificationImagesCacheSend Emails

Load Balancer + Auto Scale

Cloud Front

S3LambdaSES

SNS

Page 40: AWS intro

AWS - endless featureGIT

Deployment

CDN

Monitoring

Analytics

Page 41: AWS intro

Questions?

Page 42: AWS intro

Contact Me

Website: www.haberman.io

Email: [email protected]

Twitter: @hab_mic

Blog: http://blogs.microsoft.co.il/michaelh/