More Related Content Similar to What's new with Serverless (20) More from Keisuke Nishitani (12) What's new with Serverless2. #aws_serverless
Profile
Keisuke Nishitani
Specialist Solutions Architect, Amazon Web Service Japan K.K
@Keisuke69 Keisuke69
✤ Specialist SA
- Serverless
- Mobile
- DevOps
- Application Service
✤ ソーシャルで⾚ドクロの⼈です
✤ RESTおじさん
✤ 餃⼦の王将エヴァンジェリスト(⾃称)
✤ ⾳楽が好きです、フジロッカーです、今年も⾏きました
✤ ブログ: http://keisuke69.hatenablog.jp/
Keisuke69 Keisuke69Keisuke69x
7. #aws_serverless
AWS Serverless Application Model
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Resources: GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://flourish-demo-bucket/todo_list.zip
Handler: index.gethtml
Runtime: nodejs4.3
Policies: AmazonDynamoDBReadOnlyAccess
Events:
GetHtml: Type: Api
Properties: Path: /{proxy+} Method: ANY
ListTable: Type: AWS::Serverless::SimpleTable
Functions
APIs
Storage
8. #aws_serverless
AWS Serverless Application Model
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Resources: GetHtmlFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://flourish-demo-bucket/todo_list.zip
Handler: index.gethtml
Runtime: nodejs4.3
Policies: AmazonDynamoDBReadOnlyAccess
Events:
GetHtml: Type: Api
Properties: Path: /{proxy+} Method: ANY
ListTable: Type: AWS::Serverless::SimpleTable
AWSTemplateFormatVersion: '2010-09-09'
Resources:
GetHtmlFunctionGetHtmlPermissionProd:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:invokeFunction
Principal: apigateway.amazonaws.com
FunctionName:
Ref: GetHtmlFunction
SourceArn:
Fn::Sub: arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${ServerlessRestApi}/Prod/ANY/*
ServerlessRestApiProdStage:
Type: AWS::ApiGateway::Stage
Properties:
DeploymentId:
Ref: ServerlessRestApiDeployment
RestApiId:
Ref: ServerlessRestApi
StageName: Prod
ListTable:
Type: AWS::DynamoDB::Table
Properties:
ProvisionedThroughput:
WriteCapacityUnits: 5
ReadCapacityUnits: 5
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- KeyType: HASH
AttributeName: id
GetHtmlFunction:
Type: AWS::Lambda::Function
Properties:
Handler: index.gethtml
Code:
S3Bucket: flourish-demo-bucket
S3Key: todo_list.zip
Role:
Fn::GetAtt:
- GetHtmlFunctionRole
- Arn
Runtime: nodejs4.3
GetHtmlFunctionRole:
Type: AWS::IAM::Role
Properties:
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AmazonDynamoDBReadOnlyAccess
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
ServerlessRestApiDeployment:
Type: AWS::ApiGateway::Deployment
Properties:
RestApiId:
Ref: ServerlessRestApi
Description: 'RestApi deployment id:127e3fb91142ab1ddc5f5446adb094442581a90d'
StageName: Stage
GetHtmlFunctionGetHtmlPermissionTest:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:invokeFunction
Principal: apigateway.amazonaws.com
FunctionName:
Ref: GetHtmlFunction
SourceArn:
Fn::Sub: arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${ServerlessRestApi}/*/ANY/*
ServerlessRestApi:
Type: AWS::ApiGateway::RestApi
Properties:
Body:
info:
version: '1.0'
title:
Ref: AWS::StackName
paths:
"/{proxy+}":
x-amazon-apigateway-any-method:
x-amazon-apigateway-integration:
httpMethod: ANY
type: aws_proxy
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-
31/functions/${GetHtmlFunction.Arn}/invocations
responses: {}
swagger: '2.0'
REPLACES:
11. #aws_serverless
Serverless CI/CD pipeline
✤ CodePipelineを⽤いてGithubもしくはCodeCommitからソースを直接Pull
✤ AWS CodeBuildでサーバレスアプリのビルドとパッケージング
⎻ Npm、pip、Javaコンパイル
✤ AWS CloudFormationで完成したアプリをデプロイ
GitHub
Source Deploy
CloudFormationCodeBuild
Build
NEW!
18. #aws_serverless
デッドレターキュー(Dead Letter Queue, DLQ)
✤ 信頼性の⾼いエンドツーエンドのイベン
ト処理ソリューションの作成が簡単に
✤ 3回実⾏しても処理されなかったイベント
をSQSのキューもしくはSNSトピックへ
と送信
✤ コードに問題が有る場合や、スロットル
される場合もイベントを保存
✤ ファンクション単位
✤ すべての⾮同期呼び出しで利⽤可能 Amazon
SQS
Amazon
SNS
AWS
Lambda
21. #aws_serverless
Lambda Bots and Amazon Lex
•テキストスピー
チ
•ビジネスロジッ
クをLambdaで実
⾏
•Facebook、
MobileHub
•Slackおよび
Twilio とのインテ
グレーションは
近⽇中
I’d like to book a hotel