#cmdevio4
CX
2013
JUnit
Web AWS
Java Python/Ruby Node.js
AWS API
AWS, Lambda, Serverless
API, ,
vue.js Angular
/ IoT
ToF
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
Developers.IO CAFE
Developers.IO CAFE deGO
2018.07 2019.07
Developers.IO CAFE deGO
WT
Developers.IO CAFE deGO
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
•
•
•
→
→
→
https://speakerdeck.com/twada/quality-and-speed
© t_wada
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
AWS
AWS
VPN
IAM
IoT AWS
IoT Action Lambda
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
Auth0
SMS
LINE
3 Cognito
API
UI/UX
Oauth2
SMS
Rule /signup API
API Gateway Authorizer
ID
Role
API
meta_data
API
Auth0 Role
JSON Web Token
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
:
:
DevelopersIO CAFE
Auth0
/
Dev.IO
OAuth
/
WT/MO
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
API
current
Developers.IO CAFE
stable
Lambda API
Lambda Alias
: alias
API Gateway Stage
Stage Lambda
Stage Alias
2
CloudFront
SPA /
CORS
DynamoDB
stage/current
Cross-Origin Resource Sharing (CORS)
SPA API
API
CloudFront
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
AWS
S3 Bucket / Secret Manager
API Gateway
CodePipeline / CodeBuild
Lambda / StepFunctions
CloudFormation
Route53
Lambda CloudFormation
Lambda
API Gateway swagger
API
swagger CFn
CFn
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
Layers
Lambda
Lambda Layer
Layer Layer
Lambda
Layer
Layer
Layer
nodejs/node_modules
npm install zip
layers

" shared

# $ nodejs 

# " node_modules

# " shared

# # " index.js

# # $ package.json

# $ package.json

$ libs

$ nodejs

" node_modules
$ package.json
{

"name": "shared",

"main": "index.js",

"private": true

}
require('shared');
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
AWS
Lambda
AWS
AWS
Apex
Layer
AWS stable/current
AWS ID
Lambda Alias
API Gateway Stage
API
Swagger
API Gateway
CloudFormation
/mo/order:

post:

summary: Order

parameters:

- in: body

response:

200:

description: An transaction
CloudFormation
Alias API Gateway/Stage
AWS
AWS API (CLI, SDK)
Apex
Lambda
Lambda Alias
API Gateway Stage
Node.js + AWS SDK
Caporal CLI
cappuccino-api

" project.itg.yaml

" project.stg.yaml

$ functions

" api_mng 

$ api

" mo_items 

$ mo_order 

" index.js

" function.yaml

$ event.test.json
$ cap functions deploy itg mo_order
aws_profile: cap-itg
memory: 512
timeout: 15
role: arn:aws:iam:XXXXXXXX:role/lambda_role
environment:
TZ: Asia/Tokyo
LOG_DEBUG: "true"
layers:
- libs
- shared
cappuccino-api

" project.itg.yaml

" project.stg.yaml

$ functions

" api_mng 

$ api

" mo_items 

$ mo_order 

" index.js

" function.yaml

$ event.test.json
$ cap functions invoke itg mo_order
{

"store_code": "deviocafe_mo-akb",

"user_id": "user|xxxxxxxx",

"payment_type": "stripe-card",

"items": [

{ "user_id": "item_xx", "qty": 2 }
]

}
$ cap functions publish itg
$ cap api deploy itg
$ cap api stage itg
CodePipeline
GitHub
Pipeline
CodeBuild
Lambda / API Gateway
IAM Role
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
Step Functions
WT
Lambda
EC2
Step Functions
Lambda
Lambda
{

"status": "in_store",

"transaction_no": "wt_002",

"timestamp": 1234567890

}
{

"status": "in_store",

"transaction_no": "wt_002",

"timestamp": 1234567890,
"total": 820

}
{

"status": "checkout",

"transaction_no": "wt_002",

"timestamp": 1234567890,
"total": 820

}
INPUT
INPUTOUTPUT OUTPUT
Lambda
Cloud Watch Events
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
Lambda
SaaS
API
const AWS = require('aws-sdk');

const SecretsManager = new AWS.SecretsManager();

const secretValue = await SecretsManager.getSecretValue({
SecretId: `tenant/${tenant_code}`
}).promise();
const secrets = JSON.parse(secretValue.SecretString);
const apiKey = secrets.STRIPE_API_KEY;
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
lambda-log
JSON
https://github.com/KyleRoss/node-lambda-log
CloudWatch Logs Insight
JSON
CloudWatch Logs
Cloud Watch Alarm
Subscription Filter
Slack
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
DynamoDB
API
Hash Key Range Key
RDB
API
NoSQL
RDB
Timestamp
Range Key
Unix Timestamp Range Key
Hash + Rang
/ / → NG
Hash Key
scan
→
Hash Key
type
GSI
LSI
Hash Key
API
API
GSI
GSI
Hash Key
API 1
1
DynadmoDB
ConditionalCheckFailedException
TTL (Time to Live
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
d3.js
API
•DevIO CAFE
•
•AWS
•Auth0
•
•API
•
•Layers
•
•Step Functions
•
•
•DynamoDB
•
•
/
API Lambda
AWS, Lambda, Serverless
API, ,
vue.js Angular
/ IoT
ToF
Serverless - Developers.IO 2019

Serverless - Developers.IO 2019