Serverless Framework
.oO((l _ l))
DreeVee ()
ServerlessArchitecture FaaS
ServerlessFramework
Case Study
ServerlessArchitecture FaaS
ServerlessFramework
Case Study
?
() ?
Client
Process
Client
Event
Process
Client
Event
Process
Client
Client Client Client ClientClient ClientClient Client Client Client
Process
Client
Client Client Client ClientClient ClientClient Client Client Client
Process
Process
Process
Client
Client Client Client ClientClient ClientClient Client Client Client
Process
Process
Event (Load balancing) (Scale up)Process (Scale out)
Ver.
Event (Load balancing) (Scale up)Process (Scale out)
Ver.
(
?
Process
Client
Client Client Client ClientClient ClientClient Client Client Client
Process
Process
Client Client Client Client ClientClient ClientClient Client Client Client
Fun
Fun
Fun
Fun
Fun
Fun
BaaS (Backend as a Service)FaaS (Function as a Service)
S3, Cognito, Pusher, Auth0, Algolia,
FunctionApplication server
cost
Awesome
https://github.com/anaibol/awesome-serverless
Tips:serverless()(Serverless Framework ()
)
ServerlessArchitecture FaaS
ServerlessFramework
Case Study
FaaS ?
FaaS ?
AWS LambdaGoogle Cloud Functions
Azure FunctionsIBM OpenWhisk
FaaS (Function as a Service) ?
FaaS (Function as a Service) ?
FaaS ( as a Service) ?
Function (, )
P Qf
Function
: :
() Function=
Function
11
FaaS ?
Event source Function
Event
Event source Function
Event
Function
Function
Function
Event source
Event source
Event source
Event source
Function
Event source
Event source
Function
Function
Function
Function
Function
Function
Event
Event source
Function
Event source
Event source
Function
Function
Function
Function
Function
Function
Event
EventFunction11
FaaS
Function
FaaS
11
Event (Load balancing) (Scale up)Process (Scale out)
Ver.
FaaS
Event (Load balancing) (Scale up)
Process (Scale out)Log
Ver.Blue-Green
FaaS
Event (Load balancing) (Scale up)
Process (Scale out)Log
Ver.Blue-Green
(*)o*o(*)
Tips:FaaS()(Fraud as a Service:
named by RSA Security@2008)
ServerlessArchitecture FaaS
ServerlessFramework
Case Study
https://serverless.com/
Serverless Framework
FaaSserviceframework
(l _ l)FaaSframework?
(FaaSFaaS)Oo.(l _ l)
Event source Function
Event
Function
Event source Function
Event
Function
Event source?
Evet source
Storage/cron/HTTP access/MQTT access
AWS LambdaAPI Gateway
API Gateway
REST interface
?
TerraformAWS resource
API GatewayLambda - c4sehttp://c4se.hatenablog.com/entry/2016/07/26/122508
TerraformAWS resourceAPI GatewayLambda - c4se http://c4se.hatenablog.com/entry/2016/07/26/122508
aws_lambda_function/aws_lambda_alias/aws_lambda_alias/aws_lambda_permission/aws_lambda_permission/aws_api_gateway_rest_api/aws_api_gateway_deployment/aws_api_gateway_deployment/aws_api_gateway_resource/aws_api_gateway_resource/aws_api_gateway_method/aws_api_gateway_method/aws_api_gateway_integration/aws_api_gateway_integration/aws_api_gateway_method_response/aws_api_gateway_method_response/aws_api_gateway_method_response/aws_api_gateway_method_response/aws_api_gateway_method_response/aws_api_gateway_method_response/aws_api_gateway_integration_response/aws_api_gateway_integration_response/aws_api_gateway_integration_response/aws_api_gateway_integration_response/aws_api_gateway_integration_response/aws_api_gateway_integration_respon
se
TerraformAWS resourceAPI GatewayLambda - c4se http://c4se.hatenablog.com/entry/2016/07/26/122508
deploy
1. aws_lambda_alias.prodfunction_version"$LATEST" Lambdapublish_version
2. LambdaAPI Gateway3. API Gatewaystaging4. staging5. Lambdapublish_versionVersion6. aws_lambda_alias.prodfunction_version
7. Lambda8. API Gatewayprod
TerraformAWS resourceAPI GatewayLambda - c4se http://c4se.hatenablog.com/entry/2016/07/26/122508
deploy
1. aws_lambda_alias.prodfunction_version"$LATEST" Lambdapublish_version
2. LambdaAPI Gateway3. API Gatewaystaging4. staging5. Lambdapublish_versionVersion6. aws_lambda_alias.prodfunction_version
7. Lambda8. API Gatewayprod
(
TerraformAWS resourceAPI GatewayLambda - c4se http://c4se.hatenablog.com/entry/2016/07/26/122508
deploy
1. aws_lambda_alias.prodfunction_version"$LATEST" Lambdapublish_version
2. LambdaAPI Gateway3. API Gatewaystaging4. staging5. Lambdapublish_versionVersion6. aws_lambda_alias.prodfunction_version
7. Lambda8. API Gatewayprod
Event sourceEvent sourceFunction
!
Serverless Framework
provider:stage: staging
functions:example:
handler: handler.handlerevents:
- http:path: "example/examplemethod: getintegration: lambda
- http:path: "example/examplemethod: putintegration: lambda
Serverless Framework
`sls deploy s prod`
Serverless Framework
`sls deploy s prod`(*)o*o(*)
Serverless Framework
FaaSFunction/Event source/servicedeploytool
AWSServerless Framework
Cloud Formation + Lambda
Suuuuuuuuuuuuuuuuper simple!
Tips:Serverless Framework(l _ l)
ServerlessArchitecture FaaS
ServerlessFramework
Case Study
HTTP service
Serverless Frameworkv0.5v1.0
RDSslow query
HTTP service
Serverless Frameworkv0.5v1.0
RDSslow query
RDS1slowquery
log
RDS1slowquery
log
RDS1
slowquerylog
CloudWatchSchedule
Lambda
Chatroom
1/1 hour
service: xxx-export-slow-query
provider:name: awsregion: ap-northeast-1stage: prodruntime: python2.7iamRoleStatements:- Effect: AllowAction:- rds:DescribeDBLogFiles- rds:DownloadDBLogFilePortion
Resource:- arn:aws:rds:*
package:exclude:- tasks.py- tests
functions:exportToChat:handler: handler.export_to_chatmemorySize: 512timeout: 6events:- schedule: rate(1 hour)
slowquery.logIAM role
HTTP service
Serverless Frameworkv0.5v1.0
RDSslow query
0
Access
system
system
micro service
API Gateway + Lambda + DynamoDB!
APIGateway Lambda
/ DynamoDB
()
DynamoDB
()
GET/PUT
GET/PUT
DynamoDBtransaction(+ TerraformTerraform)
HTTP service
Serverless Frameworkv0.5v1.0
RDSslow query
HTTP serviceServerless Framework v0.5
v1.0release
v0.5
/s-project.jsonfunctions/
fun-a/s-function.jsonas code
fun-b/s-function.jsonbs code
v1.0
/serverless.ymlfun-a&fun-bs code
v0.5v1.0
(AWS)
FunctioncodeAWSresource
v0.5v1.0
AWSresourceupgrade
LambdaAPI
Gatewaycustomedomain
APIGatewayresource
Lambda
APIGatewaycustomedomain
APIGatewayresource
LambdaAPI
Gatewayresource
APIGatewaycustomedomain
LambdaAPI
Gatewayresource
What?/Why?
Function
Function11
Serverless FrameworkFaaSservicedeploytool
What?/Why?
cost
FaaSApplication
Serverless FrameworkFaaSdeploy
Top Related