serverlessconf tokyo キーノート

45
© 2016 Amazon Web Services, Inc. or its Affiliates. All rights reserved. Olivier Klein 甂禼㳓, AWS Solutions Architect, Asia-Pacific October 2016 ServerlessConf, Tokyo Go Serverless, Compute Only When it Matters!

Upload: amazon-web-services-japan

Post on 16-Apr-2017

2.767 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: ServerlessConf Tokyo キーノート

© 2016 Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Olivier Klein , AWS Solutions Architect, Asia-Pacific October 2016 ServerlessConf, Tokyo

Go Serverless, Compute Only When it Matters!

Page 2: ServerlessConf Tokyo キーノート

The Monolithic Architecture

Page 3: ServerlessConf Tokyo キーノート

The Monolithic Architecture - Antipattern

  Difficult to scale

  Single point of failure

  Not fault-tolerant

  Difficult to work across teams, often slow to iterate on new functionalities

Page 4: ServerlessConf Tokyo キーノート

The Microservices Architecture

Page 5: ServerlessConf Tokyo キーノート

Microservices advocate creating a system from a collection of small, isolated services,

each of which owns their data, scalable and resilient to failure

Page 6: ServerlessConf Tokyo キーノート

Dr. Werner Vogels CTO - Amazon

Page 7: ServerlessConf Tokyo キーノート

No server is easier to manage…

Page 8: ServerlessConf Tokyo キーノート

…than no server.

No server is easier to manage…

Page 9: ServerlessConf Tokyo キーノート

AWS Lambda

No server is easier to manage…

…than no server.

Page 10: ServerlessConf Tokyo キーノート

The Microservices Architecture

Page 11: ServerlessConf Tokyo キーノート

Serverless Microservices

Page 12: ServerlessConf Tokyo キーノート

Architect to be Serverless Serverless

  Fully Managed

•  No provisioning

•  Zero Administration (

•  High-Availability

  Developer Productivity

•  Focus on the code

•  Innovate rapidly

•  Reduce time to market

  Scalability

•  Automatically

•  Scale up and down Up/Down

Page 13: ServerlessConf Tokyo キーノート

Many Serverless Options on AWS Serverless

Storage Database Network

Compute Content Delivery Messaging and Queues Security

Gateways

User Management Monitoring & Logging

Internet of Things

Machine Learning

Streaming Analytics

Page 14: ServerlessConf Tokyo キーノート

13 Regions

35 Availability Zones

63 Edge Locations

Continuous Expansion

AWS Global Infrastructure AWS

(As of September, 2016)

Page 15: ServerlessConf Tokyo キーノート

13 Regions

35 Availability Zones

63 Edge Locations

Continuous Expansion

AWS Global Infrastructure AWS

New!

New!

(As of September, 2016)

Page 16: ServerlessConf Tokyo キーノート

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 DynamoDB

Amazon API Gateway

Amazon SNS

Page 17: ServerlessConf Tokyo キーノート

Amazon S3 Amazon DynamoDB

Amazon Kinesis

AWS CloudFormation

AWS CloudTrail Amazon CloudWatch

Amazon SNS AmazonSES

AmazonAPI Gateway

Amazon Cognito

AWSIoT

AmazonAlexa

Cron events

DATA STORES ENDPOINTS

REPOSITORIES EVENT/MESSAGE SERVICES

Event Sources that integrate with AWS Lambda (AWS Lambda )

… and the list continues to grow.

Amazon Config

Page 18: ServerlessConf Tokyo キーノート

How to build application backends?

Back-end logic Database Mobile

Page 19: ServerlessConf Tokyo キーノート

How to build serverless microservices? Serverless Microservices

AWS Lambda

Amazon API Gateway

Amazon DynamoDB

Microservice

Page 20: ServerlessConf Tokyo キーノート

How to build serverless microservices? Serverless Microservices

AWS Lambda

Amazon API Gateway

Amazon DynamoDB

Microservice 1

Microservice 2

Microservice N

...

Page 21: ServerlessConf Tokyo キーノート

Amazon API Gateway

  Fully managed and scalable RESTful API gateway service

  Powered by our content delivery network via 63 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

Page 22: ServerlessConf Tokyo キーノート

Amazon API Gateway: Authorization

Amazon API Gateway

  Allows unauthenticated requests, or authorizes via AWS IAM   Amazon Cognito or AWS STS for temporary credential generation   API Keys available to monitor individual app calls   You can create API Key specific throttling and usage plans

Basic – 5 TPS

Premium – 100 TPS

Power – No throttling

API Keys – Usage Plans

Amazon Cognito

AWS IAM

Page 23: ServerlessConf Tokyo キーノート

Webhooks – Integrate with other platforms

Facebook Page AWS Lambda

Slack Channel

Amazon API Gateway

Amazon DynamoDB

Incoming Webhook

Oli just posted on your page!

Oli | 2016-10-01 |

Hello

Page 24: ServerlessConf Tokyo キーノート

Okasan Online Securities (岡三オンライン証券株式会社)

“AWS のクラウドネイティブアーキテクチャーにより運用面での作業はほとんど必要なくなり、コストも従来型のアーキテクチャーと比較して、7 分の 1 程度にまで削減することができています。 今のところセキュリティ、実績、コスト、機能の面で AWS に勝るクラウドベンダーはありません。 ”

野崎 保 氏事業戦略担当部長

  Online Trading Demo Platform

  Live Stock Market Feed and Order Management delivered via Amazon API Gateway and AWS Lambda

  1/7 of cost reduction

Page 25: ServerlessConf Tokyo キーノート

How to get the web app to the browser? Web

?

Page 26: ServerlessConf Tokyo キーノート

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 63 edge

locations across the world •  Caches content on edge locations for low

latency

Page 27: ServerlessConf Tokyo キーノート

Amazon S3 Amazon

CloudFront Browser

Page 28: ServerlessConf Tokyo キーノート

Serverless App Architecture

JavaScript SDK

Browser

Amazon S3

Amazon CloudFront

Amazon Lambda

Amazon DynamoDB

Amazon API Gateway

Any other AWS Services (e.g. SNS,

SES, ElastiCache etc.)

Page 29: ServerlessConf Tokyo キーノート

Introducing Chalice 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"}

Page 30: ServerlessConf Tokyo キーノート

Serverless with AWS

Amazon Lambda

Amazon API Gateway

Amazon S3 Amazon CloudFront

Browser

Page 31: ServerlessConf Tokyo キーノート

MOBILE CHAT APP

AD DATA ANALYTICS AND ROUTING

MOBILE APP ANALYTICS

IMAGE CONTENT FILTERING

REAL-TIME VIDEO AD BIDDING

NEWS CONTENT PROCESSING

GENE SEQUENCE SEARCH

CLOUD TELEPHONY

DATA PROCESSING

WEB APPLICATIONS

WEB APPLICATIONS THREAT INTELLIGENCE AND ANALYTICS

NEWS CONTENT PROCESSING

GAME METRICS ANALYTICS

Serverless Applications

Page 32: ServerlessConf Tokyo キーノート

How about deployments?

Page 33: ServerlessConf Tokyo キーノート

Versioning

  Immutable versions of functions   Per version configuration

  Per version Cloudwatch metrics

Cloudwatch Logs contain version attribute

  Aliases to “label” a version release

  $LATEST contains latest code

Page 34: ServerlessConf Tokyo キーノート

$LATEST(95) STABLE TESTING

94 X

93 X

92

Update Alias to Deploy

Page 35: ServerlessConf Tokyo キーノート

$LATEST(95) STABLE TESTING

94 X X

93

92

Update Alias to Deploy

Page 36: ServerlessConf Tokyo キーノート

API Stages API

Page 37: ServerlessConf Tokyo キーノート

API Gateway Stage Variables API Gateway

Page 38: ServerlessConf Tokyo キーノート

API Gateway Stage Variables API Gateway

Page 39: ServerlessConf Tokyo キーノート

API Gateway Lambda Custom Domain

/prod/Resources FunctionName:stable https://api.example.com

/dev/Resources FunctionName:$LATEST https://dev.example.com

/qa/Resources FunctionName:qa https://qa.example.com

Pin your environment with stage variables

Page 40: ServerlessConf Tokyo キーノート

Alexa, Hello!

Page 41: ServerlessConf Tokyo キーノート

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 everyone to build and publish their own skills

  Skills can be powered by AWS Lambda

Page 42: ServerlessConf Tokyo キーノート

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; HelloWorld.prototype.eventHandlers.onLaunch = function (launchRequest, session, response) {

var speechOutput = ”Hello World”; response.tell(speechOutput);

};

Page 43: ServerlessConf Tokyo キーノート

Build your own Alexa Skill!

Amazon Echo

Alexa Skills Kit

AWS Lambda Amazon DynamoDB

(Facebook Page

Post)

Page 44: ServerlessConf Tokyo キーノート

Final Thoughts

  Use Amazon API Gateway to build a front-door to all your microservices (AWS Lambda, Docker, EC2 etc.)

  Use microservices with polyglot persistence to avoid bottlenecks, schema issues, quick iterations and allow independent scalability (and caching)

  Create many version and stages – no additional charges for APIs, allows for backwards compatibility   Use serverless interfaces when possible – HTML5 and JS frameworks like React or Angular are useful

Page 45: ServerlessConf Tokyo キーノート

© 2016 Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Olivier Klein , AWS Solutions Architect, Asia-Pacific October 2016 ServerlessConf, Tokyo

Thank You!