Programming Amazon Web Services

Preview:

DESCRIPTION

 

Citation preview

PROGRAMMING AMAZON WEB SERVICES

Danilo Poccia | Solutions Architect

“PROGRAMMING”

DIFFERENT MEANINGS

IN

DIFFERENT TIMES

AT THE

BEGINNING

(FOR ME)

WAS

THIS

THERE

WERE

NO “APPS”

SO I HAD TO WRITE SOMETHING

CROSSING MY FINGERS

INSTALLING MY FIRST LINUX

EVERYTHING

CHANGED

WITH

WWW

http://petelepage.com/blog/2011/11/html5-guy-gelaskin/

A RICH CLIENT

EXPERIENCE IN

MY BROWSER

CAN HTTP

BE THE LIMIT?

WEBSOCKETS

WEBSOCKETS

FULL-DUPLEX

WEBSOCKETS

FULL-DUPLEX

(NO POLLING)

WEBSOCKETS

HANDSHAKE

WEBSOCKETS

HANDSHAKE

GET /chat HTTP/1.1

Host: server.example.com

Upgrade: websocket

Connection: Upgrade

Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==

Origin: http://example.com

Sec-WebSocket-Protocol: chat, superchat

Sec-WebSocket-Version: 13

WEBSOCKETS

HANDSHAKE

GET /chat HTTP/1.1

Host: server.example.com

Upgrade: websocket

Connection: Upgrade

Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==

Origin: http://example.com

Sec-WebSocket-Protocol: chat, superchat

Sec-WebSocket-Version: 13

HTTP/1.1 101 Switching Protocols

Upgrade: websocket

Connection: Upgrade

Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=

Sec-WebSocket-Protocol: chat

• server.js

• package.json

• Player.js

• public/

• index.html

• style/

• reset.css

• game.css

• js/

• requestAnimationFrame.js

• Input.js

• game.js

• Player.js

SERVER

CLIENT

• server.js

• package.json

• Player.js

• public/

• index.html

• style/

• reset.css

• game.css

• js/

• requestAnimationFrame.js

• Input.js

• game.js

• Player.js

SINGLE

APP

Node.js

+

Socket.IO

“HOW

DO I DEPLOY

MY APP ?”

You need to deal with infrastructure

ON-DEMAND

PAY AS YOU GO

ELASTIC

On a global footprint

Region

US-WEST (N. California) EU-WEST (Ireland)

ASIA PAC

(Tokyo)

ASIA PAC

(Singapore)

US-WEST (Oregon)

SOUTH AMERICA (Sao

Paulo)

US-EAST (Virginia)

GOV CLOUD

ASIA PAC

(Sydney)

ELASTIC

BEANSTALK QUICKLY DEPLOY AND MANAGE

APPLICATIONS

CHOOSE YOUR CONTAINER

DEPLOY

YOUR

APPLICATION

User Application

Application Service

HTTP Service

Language Interpreter

Operating System

Host

THE CONTAINER

IS CREATED IN EC2

ELASTIC BEANSTALK TAKES CARE

OF THE ENVIRONMENT

ADDING

ELASTIC LOAD BALANCER

CONFIGURING

AUTO SCALING GROUP

LAUNCHING

INSTANCE(S)

ALL WIRED WITH

ELASTIC

BEANSTALK

APPLICATION IS PUBLISHED

UNDER A CNAME

WITH LOGS AND

APP VERSIONS

STORED

IN S3

HOW

DO YOU CREATE

AN

APPLICATION

FOR

ELASTIC BEANSTALK ?

LIKE

ANY

OTHER

APPLICATION

Source uploaded and executed in AWS

Source downloaded

and executed locally NO DEPENDENCIES ON AWS

FOR BEANSTALK DEPLOYMENT

Java .war file

Microsoft Web

Deploy package

PHP .zip file

Python .zip file

Git integration IDE plugins

PACKAGE UP AS NORMAL

CONSOLE DEPLOYMENTS

AND VERSION UPDATES

CheckDNSAvailability elastic-beanstalk-check-dns-availability

CreateApplication elastic-beanstalk-create-application

CreateApplicationVersion

elastic-beanstalk-create-application-version

CreateEnvironment

elastic-beanstalk-create-environment

eb init wizard to initialize an application

eb start/stop start/stop an application

eb update

update application version

eb status

get status of a running application

COMMAND LINE TOOLS

AND “WIZARDS”

ECLIPSE INTEGRATION

VISUAL STUDIO INTEGRATION

GIT INTEGRATION

CONTAINER CONFIGURATION

“Elastic Beanstalk ci ha permesso di

sfruttare la potenza dell’Auto Scaling di

EC2 senza alcuna fatica.

La procedura di deploy integrata con

git è veramente comoda e veloce.”

FunGo Studios

www.fungostudios.com

AWS Elastic

Beanstalk

AWS

OpsWorks AWS

CloudFormation

Amazon EC2

AWS Elastic

Beanstalk

AWS

OpsWorks AWS

CloudFormation

Amazon EC2

CONVENIENCE CONTROL

AWS Elastic

Beanstalk

AWS

OpsWorks AWS

CloudFormation

Amazon EC2

CONVENIENCE CONTROL

HIGH-LEVEL DO IT YOURSELF

THERE IS

NO ADDITIONAL CHARGE

FOR USING

ELASTIC BEANSTALK

OPSWORKS

CLOUDFORMATION

YOU PAY ONLY FOR THE

AWS RESOURCES

NEEDED TO

STORE AND RUN

YOUR

APPLICATIONS

= PROGRAMMABLE

PLATFORM

API | SDK | CLI

API | SDK | CLI

“Amazon DynamoDB initially served as a secondary data

store for user activity and interaction logs.

However, this new NoSQL database service was

integrated into the production environment as the primary

data store when Shazam realized it could support over

500,000 writes per second.

The company is also using Amazon EMR for large-scale

data analysis that can require more than 1 million writes

per second.”

“All files stored

online by Dropbox

are encrypted and

kept securely on

Amazon’s Simple

Storage Service

(S3) in multiple data

centers located

across the United

States.”

Object Storage

Send Email

Message Queue

Notification (Pub & Sub)

NoSQL DB

Video Transcoding

Content Delivery

Monitoring

WHAT DO I NEED TO ? DO

S3

SES

SQS

SNS

DynamoDB

Elastic Transcoder

CloudFront

CloudWatch

Object Storage

Send Email

Message Queue

Notification (Pub & Sub)

NoSQL DB

Video Transcoding

Content Delivery

Monitoring

WHAT DO I NEED TO ?

AWS is a set of building blocks

« Improving daily work is even

more important than doing daily

work. »

Gene Kim, Kevin Behr, George Spafford,

The Phoenix Project: A Novel About IT, DevOps,

and Helping Your Business Win

var AWS = require('aws-sdk');

sqs = new AWS.SQS();

sqs.client.getQueueUrl(

{ QueueName: 'JustAGame-Queue’ },

function(err, data) {

if (!err) {

console.log("Get Queue URL: "+data.QueueUrl);

queueUrl = data.QueueUrl;

} else {

console.log("Error getting Queue URL: "+err);

}

}

);

sqs.client.sendMessage(

{

QueueUrl: queueUrl,

MessageBody: 'onNewPlayer id: '+this.id

},

function(err, data) {

if (!err) {

console.log("Message sent, id: "+data.MessageId);

} else {

console.log("Error sending message: "+err);

}

}

);

SCALABILITY

SESSION DATA

SCALABILITY

OTHER DATA

SESSION DATA

SCALABILITY

OTHER DATA

DynamoDB Redis

Memcached/ElastiCache …

DynamoDB MySQL/RDS

Redis …

TIME FOR

A DEMO

A prototype shouldn't require big investments…

…it should be cheap and validate ideas

Problem:

Needed to reduce IT costs and were looking

to create a more flexible IT environment

Solution:

AWS’s low, pay-as-you-go prices and reliable

services. With every request, the application

authenticates devices, delivers apps and

content, and pushes notifications.

Business Benefits:

Saved $34M in hardware and maintenance

expenses, 85% less than running on-

premises

Samsung saved $34M on their Smart Hub

application

INNOVATE

« Want to increase innovation?

Lower the cost of failure »

Joi Ito

http://aws.amazon.com/free

Recommended