Connect and Interconnect – The Mesh of Event-Driven Compute and Marvelous Virtual Worlds

70
AWS Cloud Kata for Start-Ups and Developers Hong Kong Connect and Interconnect The Mesh of Event-Driven Compute and Marvelous Virtual Worlds Olivier Klein 奧樂凱, Senior Solutions Architect, AWS

Transcript of Connect and Interconnect – The Mesh of Event-Driven Compute and Marvelous Virtual Worlds

AWS Cloud Kata for Start-Ups and Developers

Hong Kong

Connect and InterconnectThe Mesh of Event-Driven Compute and

Marvelous Virtual Worlds

Olivier Klein 奧樂凱, Senior Solutions Architect, AWS

AWS Cloud Kata for Start-Ups and Developers

Innovation

AWS Cloud Kata for Start-Ups and Developers

Innovation?

Why Do Companies Innovate?

Innovation = Growth

AWS Cloud Kata for Start-Ups and Developers

Innovation = Growth!

« …innovation is now recognized as

the single most important ingredient in

any modern economy…In short, it is

innovation – more than the application

of capital and labor – that makes the

world go round »

AWS Cloud Kata for Start-Ups and Developers

Organizational Effectiveness – Which one are you?

AWS Cloud Kata for Start-Ups and Developers

Lower the Cost of Failure

« Invention requires two

things: the ability to try a

lot of experiments, and

not having to live with

the collateral damage of

failed experiments » Andy JassyCEO, Amazon Web Services

AWS Cloud Kata for Start-Ups and Developers

Let’s Innovate!

Reduce undifferentiated heavy lifting (Business Focus)

Lower the cost of failure (Experiment often)

Automate and optimize (Become agile)

Engage on the channel of your customer’s choice

(Customer Obsession)

Measure, improve and iterate (Feedback Loop)

Integrate with other platforms (Ecosystem)

Today we will focus on:

AWS Cloud Kata for Start-Ups and Developers

Containers

AWS Cloud Kata for Start-Ups and Developers

Let’s talk about scaling an app first…

Order UI User UIShipping

UI

Order

Service

User

Service

Shipping

Service

Data

Access Amazon EC2

AWS Cloud Kata for Start-Ups and Developers

Horizontal Auto-Scaling

AWS Cloud Kata for Start-Ups and Developers

However a lot of people build “micro”-services instead

Order UI User UIShipping

UI

Order

Service

User

Service

Shipping

Service

AWS Cloud Kata for Start-Ups and Developers

And scale those micro-services independently

Order UI User UI UI

Order

ServiceService

Shipping

Service

Order UIOrder UI

User UI UIShipping

UI

Order

ServiceOrder

Service

ServiceService

ServiceService

Shipping

Service

AWS Cloud Kata for Start-Ups and Developers

Containers to the help!

AWS Cloud Kata for Start-Ups and Developers

What is a container?

OS-level virtualization

Handled through “cgroups”

Complete process isolation

Container Image contains all

dependencies

{

Conta

iner

AWS Cloud Kata for Start-Ups and Developers

Benefits of using Containers

Benefits

Portable (Local<->AWS)

Shared OS speeds up deployment

Flexible resource allocation (CPU

Memory, Network, Disk etc.)

{

Conta

iner

AWS Cloud Kata for Start-Ups and Developers

A Container Pipeline

Base

image

Patches

IT Operations Developer

Ruby

Redis

Logger

Utilities

App

AWS Cloud Kata for Start-Ups and Developers

Amazon EC2 Container Service

Highly scalable, high performance Docker

container management service

Eliminates the need to install, operate, and

scale your cluster management infrastructure

Schedule the placement of containers

based on resource needs and availability

requirements

Full integration with ELB, EBS, IAM etc.Amazon EC2

Container Service

AWS Cloud Kata for Start-Ups and Developers

AWS Elastic Beanstalk

AWS Elastic

Beanstalk

Easily deploy, monitor, and scale applications

Infrastructure and operating system provisioned

and managed by EB

Preconfigured application containers that are

easily customizable

AWS Cloud Kata for Start-Ups and Developers

Let’s Send a Container to the Cloud DEMO

Containers

AWS Elastic

BeanstalkInternet

AWS Cloud Kata for Start-Ups and Developers

Event-Driven

AWS Cloud Kata for Start-Ups and Developers

Polling? No thanks!

function checkNewMessage(){

// open message stream, read latest messages and alert...

alertAboutMessage();

}

while (true){ //let's create an endless loop

checkNewMessages();

sleep (1000); //sleep and repeat every second

}

Inefficient use of compute cycles, storage or stream I/O

Doesn’t scale well and is not reactive

AWS Cloud Kata for Start-Ups and Developers

Event-Driven Programming

var messageStream= new events.MessageStreamEmitter();

messageStream.on(’newMessage', alertAboutMessage);

Only react when needed, well known in modern

programming languages

What if we could translate this to our cloud infrastructure?

• Only react when a customer sends a message

• Only execute your code when a new entry in your DB is present

• Analyze the new log file only when it’s dumped into the storage

AWS Cloud Kata for Start-Ups and Developers

AWS Lambda

Run your code in the cloud, fully

managed and highly-available

Triggered through API calls or state

changes in your setup (S3,

DynamoDB, SNS, Kinesis)

Scales automatically to match the

incoming event rate

Charged per 100ms execution time

Amazon

Kinesis

Amazon Lambda

Amazon

S3

Amazon

DynamoDBAmazon API

Gateway

Amazon

SNS

AWS Cloud Kata for Start-Ups and Developers

Serverless

AWS Cloud Kata for Start-Ups and Developers

Storage and Delivery of the App

Amazon S3

Amazon

CloudFront

Amazon S3

• Highly available object storage

• Designed for 99.999999999% durability

• Offers HTTP / HTTPS endpoint to objects

Amazon CloudFront

• Content Delivery Network with 56 edge

locations across the world

• Caches content on edge locations for low

latency

AWS Cloud Kata for Start-Ups and Developers

Build a Serverless Web App!

Amazon S3 to host HTML,

Images, CSS, JS etc.

AWS Jumpy Fish is built

this way

Ok, but how about “server-

side” logic?

• AWS JavaScript SDK JavaScript SDK

Browser

• Highly Available

• Scalable

• Fully Managed

• Fault Tolerant

Amazon

S3

Amazon

CloudFront

AWS Cloud Kata for Start-Ups and Developers

Amazon API Gateway

Fully managed and scalable RESTful

API gateway service

Powered by our content delivery

network via 56 global edge locations

Provides DDoS protection and

throttling capabilities

Multiple API stages which you define

(e.g. dev, test, prod)

AWS Lambda

Amazon API

Gateway

Amazon EC2

AWS API

On-prem server

AWS Cloud Kata for Start-Ups and Developers

How to build application backends?

Back-end logic DatabaseMobile

AWS Cloud Kata for Start-Ups and Developers

How to build application backends even better?

Amazon

Lambda

Amazon API

Gateway

Amazon

DynamoDB

Microservice

AWS Cloud Kata for Start-Ups and Developers

Serverless App Architecture

JavaScript SDK

Browser

Amazon

S3Amazon

CloudFront

Amazon

Lambda

Amazon

DynamoDBAmazon API

Gateway

Any other AWS

Services (e.g. SNS,

SES, ElastiCache etc.)

AWS Cloud Kata for Start-Ups and Developers

Introducing Chalice

Serverless micro-

framework for AWS

Deploy APIs quickly via

AWS Lambda and

Amazon API Gateway

github.com/awslabs/chalice

$ chalice new-project helloworld

$ cat helloworld/app.py

from chalice import Chalice

app = Chalice(app_name="helloworld")

@app.route("/")

def index():

return {"hello": "world"}

$ chalice deploy

...

Your app is available at:

https://endpoint/dev

$ curl https://endpoint/dev

{"hello": "world"}

AWS Cloud Kata for Start-Ups and Developers

Serverless with AWS DEMO

Amazon

Lambda

Amazon API

Gateway

Amazon S3Amazon

CloudFront

Browser

AWS Cloud Kata for Start-Ups and Developers

Serverless Framework

www.serverless.com

AWS Cloud Kata for Start-Ups and Developers

Webhooks – Integrate with other platforms DEMO

Facebook

Page AWS Lambda

Slack

Channel

Amazon

API

Gateway

Amazon

DynamoDB

Incoming

Webhook

Oli just posted

on your page!

Oli | 2016-08-

03 | Hello

AWS Cloud Kata for Start-Ups and Developers

Mobile

AWS Cloud Kata for Start-Ups and Developers

Mobile is Ever Stronger…

Ref: Mobile is Eating the World (a16z)

AWS Cloud Kata for Start-Ups and Developers

Mobile Apps

Mobile often the first customer touch

point these days

Themes in app development these

days:

• Ability to scale

• Application quality

• Development & maintenance ease

AWS Cloud Kata for Start-Ups and Developers

Ability to Scale on AWS

AWS Cloud Kata for Start-Ups and Developers

0

190,000

380,000

570,000

760,000

950,000

1,140,000

1,330,000

1,520,000

1,710,000

1,900,000

Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2

2012 2013 2014 2015

Matches in Tinder since Launch (in 1,000s)

Ability to Scale on AWS

AWS Cloud Kata for Start-Ups and Developers

1.7 Billionswipes a day

October 2015

Ability to Scale on AWS

AWS Cloud Kata for Start-Ups and Developers

1.2 Trillion+Total Swipes

October 2015

Ability to Scale on AWS

AWS Cloud Kata for Start-Ups and Developers

7 Petabytesof Data Transfer per Month

October 2015

Ability to Scale on AWS

AWS Cloud Kata for Start-Ups and Developers

Amazon Cognito

Authenticate & sync

Amazon Mobile Analytics

Analyze user behavior

AWS Lambda

Run business logic

Amazon S3

Amazon DynamoDB

Store content

Store data

Amazon SNS Mobile Push

Send push notifications

Back end architecture on AWS

Mobile SDKTesting

AWS Device Farm Amazon CloudFront and Amazon S3

App Content Delivery

AWS Cloud Kata for Start-Ups and Developers

AWS Mobile Hub

Allows to build, test and monitor mobile

apps within minutes

Automatically provisions all necessary

AWS services based on selected features

Automatic code generation for iOS

(Objective-C / Swift) and Android

Uses security best practices with

AWS IAM

AWS Cloud Kata for Start-Ups and Developers

AWS Mobile Hub

AWS Cloud Kata for Start-Ups and Developers

AWS Mobile Hub: Select Features

AWS Cloud Kata for Start-Ups and Developers

AWS Mobile Hub: Resources

AWS Cloud Kata for Start-Ups and Developers

AWS Mobile Hub: Code Generation

AWS Cloud Kata for Start-Ups and Developers

AWS Device Farm: Build quality apps!

AWS Device Farm

Test your app on real devices

Many different smartphones and tablets

Full built-in test suite and integration

with frameworks

Gesture, swipe, and interact with devices

in real time, directly from your web

browser

AWS Cloud Kata for Start-Ups and Developers

Let’s build a mobile app in 5 minutes! DEMO

Amazon

Cloudfront

Amazon S3

Mobile

App

AWS Lambda Amazon

DynamoDB

Amazon

Cognito

Amazon Mobile

Analytics

AWS Cloud Kata for Start-Ups and Developers

IoT

AWS Cloud Kata for Start-Ups and Developers

All the music, in every room of your home, wirelessly.

Sonos is the smart speaker

system that streams all your

favorite music to any room

Control your music with one

simple app, and fill your home

with pure, immersive sound.

AWS Cloud Kata for Start-Ups and Developers

AWS Cloud Kata for Start-Ups and Developers

SONOS Trueplay: Smart Speaker Tuning

Trueplay measures the acoustics in any room and fine-tunes your speaker

Launched in 2015 yet available to devices purchased over 5 years ago

Data-driven evaluation and testing

AWS Cloud Kata for Start-Ups and Developers

Cloud-connected devices are constantly smarter

« A 10 year old product can do things that hadn't

been invented 10 years ago. Most importantly, going

forward, people will expect your product to improve, and if

it isn't being updated and getting better, you're literally

being left behind. »

AWS Cloud Kata for Start-Ups and Developers

AWS IoT

“Securely connect billions of

devices to AWS,

so they can interact with

applications and other

devices”

AWS Cloud Kata for Start-Ups and Developers

DEVICE SDKDEVICE

GATEWAY

AUTHENTICATION

RULES

ENGINE

AWS Services

- - - - -

3P Services

SHADOW APPLICATIONS

AWS IoT

API

REGISTRY

AWS IoT : How it works

AWS Cloud Kata for Start-Ups and Developers

Voice Control

AWS Cloud Kata for Start-Ups and Developers

Say Hello!

Alexa, Hello!

AWS Cloud Kata for Start-Ups and Developers

The Power of Speech: Alexa

Alexa, the voice service that powers

Echo, provides capabilities, or skills,

that enable customers to interact with

devices using voice.

Alexa Skills Kit (ASK) allows device

manufacturer to build their own skill

Skills can be powered by AWS

Lambda

AWS Cloud Kata for Start-Ups and Developers

The Power of Speech: Alexa

Node.js SDK available to quickly build new voice skills.

github.com/amzn/alexa-skills-kit-js

var AlexaSkill = require('./AlexaSkill');

var HelloWorld= function () { AlexaSkill.call(this, APP_ID); };

// Extend AlexaSkill

HelloWorld.prototype = Object.create(AlexaSkill.prototype);

HelloWorld.prototype.constructor = HelloWorld;

HelloWorl.prototype.eventHandlers.onLaunch = function (launchRequest, session,

response) {

var speechOutput = ”Hello World”;

response.tell(speechOutput);

};

AWS Cloud Kata for Start-Ups and Developers

Build your own Alexa Skill! DEMO

Amazon

Echo

Alexa Skills

Kit

AWS Lambda Amazon

DynamoDB

(Facebook Page

Post)

AWS Cloud Kata for Start-Ups and Developers

Virtual Worlds

AWS Cloud Kata for Start-Ups and Developers

A free AAA game engine deeply integrated with

AWS and Twitch – with full source

Free AAA Game Engine: Amazon Lumberyard

AWS Cloud Kata for Start-Ups and Developers

Amazon Lumberyard Engine

• Built based on the

successful CryEngine

• Systems by Double Helix

Games

• Cloud backend can be

powered by AWS

• Full integration with Twitch

• Integration into VR

AWS Cloud Kata for Start-Ups and Developers

Twitch - Create a Fan Base!

100M unique viewers / month

106 minutes / person / day

2M peak concurrent viewers

Leading Social Video Platform

for Gamers

Helps to build strong

communities

Leverage entertaining players to

spread adoption• Is this game worth buying?

• How do I get better at this game?

AWS Cloud Kata for Start-Ups and Developers

Interact with a virtual world! DEMO

Amazon

Lumberyard

Twitch

ChatPlay

Mobile

Phone

AWS Cloud Kata for Start-Ups and Developers

Go Build!

AWS Cloud Kata for Start-Ups and Developers

There has never been a better time to build!

Build fully-managed modular and

serverless components for your business

Interconnect devices, things and

applications to derive the best value

Interact with your customers via new means

like voice control or virtual worlds

Always build scalable and fault-tolerant

solutions

AWS Cloud Kata for Start-Ups and Developers

Thank you!

Olivier Klein 奧樂凱

Senior Solutions Architect

AWS