[re:Cap] Serverless & Mobile
Akihiro Tsukada, Senior Startup Solutions Architect
Amazon Web Services Japan K.K.
Morning Session
Name: Akihiro Tsukada
ID: akitsukada
Focus:
- Start-ups
- Mobile Apps
- Serverless
- Blockchain
- FinTech
•
•
•
•
•
•
•
•
•
•
•
•
•
AWS AppSync
type Todo {
id: ID!
name: String
description: String
priority: Int
duedate: String
}
HTTP
Http
Query / mutation
Query / mutation
•
•
1. BEFORE mapping template
2. f1 Function Request Mapping Template
3. f1 Data source invocation
4. f1 Function Response Mapping Template
5. f2 Function Request Mapping Template
6. f2 Data source invocation
7. f2 Function Response Mapping Template
8. AFTER mapping template
•
•
•
•
•
•
Delta ( ) :
BaseQuery
deltaWatcher = appSyncClient?.sync(
baseQuery: allPostsBaseQuery,
baseQueryResultHandler: { (result, error) in
// handle base query
},
subscription: postsSubscription,
subscriptionResultHandler: { (result, transaction, error) in
// handle subscription
},
deltaQuery: allPostsDeltaQuery,
deltaQueryResultHandler: { (result, transaction, error) in
// handle delta query
}
)
//Stop DeltaSync
deltaWatcher.cancel();
•
•
•
•
•
•
npm install -g @aws-amplify/cli@multienv
•
•
•
•
•
•
•
•
•
•
• 2.7/3.6
3.7
• Lambda
•
•
•
•
•
•
•
•
•
•
https://www.slideshare.net/AmazonWebServices/a-serverless-journey-aws-lambda-under-the-hood-srv409r1-aws-reinvent-2018
https://www.slideshare.net/AmazonWebServices/a-serverless-journey-aws-lambda-under-the-hood-srv409r1-aws-reinvent-2018
•
KVM
VM
• Lambda Fargate
• 125ms
VM 5MiB
•
https://github.com/firecracker-microvm/firecracker
•
• Apache License, Version 2.0
• 2018/12/17 PyCharm GA IntelliJ
Visual Studio Code
• AWS Serverless Application Model(SAM) CLI
• AWS Lambda Ruby
•
ü Python 2.7, 3.6, 3.7
ü Node.js 4.3, 6.10, 8.10
ü .NET Core 1.0(C#), 2.0(C#), 2,1(C#/PowerShell)
ü Go 1.x
ü Java 8
ü Ruby
•
1 require 'json'
2 def handler(event: ev, context:ctx)
3 {event: JSON.generate(ev),
4 context: JSON.generate(ctx.inspect)}
5 end
• --path vendor/bundle bundle install
1 module LambdaFunctions
2 class Handler
3 def self.process(event:,context:)
4 "Hello!"
5 end
6 end
7 end
source.LambdaFunctions::Handler.process.
• Linux
Lambda
• Runtime API
•
ü
ü https://github.com/awslabs/aws-lambda-rust-runtime
•
•
•
•
•
•
•
•
•
• Lambda
Lambda Layer
•
•
• 250MB
• Layer zip or S3
• Python – python, python/lib/python3.7/site-packages (site directories)
• Node.js – nodejs/node_modules, nodejs/node8/node_modules (NODE_PATH)
https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html
• python pip
node.js npm
• util
Layer
• ALB Lambda
• Lambda
HTTP
• Web
Lambda
• ALB
•
•
•
•
B 4 =A0=2
6 - / ,
B 4 =A0=2 2 = 6
0 6 : = 0B 0
= 0 : 6 6
0 6 "
0 : 2 2 40
https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html
• Step Functions AWS
Lambda
ü DynamoDB: item item
ü AWS Batch:
ü Amazon ECS/Fargate: ECS Fargate
ü Amazon SNS: SNS
ü Amazon SQS:
ü AWS Glue:
ü Amazon SageMaker:
• WebSocket
API API Gateway
• WebSocket API
• AWS Lambda
AWS
EC2
•
• AWS SAM AWS Serverless Application Repository
•
• CloudFormation
• SAM
AWS:Serverless:Application
Thank you

IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile