動作確認@本番環境
local
のテストとほとんど同じだよ!!
$sls invoke -f hello
Slide 14
Slide 14 text
おまけ1
"errorMessage": "Access Denied"
の話
local
実⾏時とデプロイ後実⾏時とで、権限が異なってないか
確認しよう
local: serverless.yml
のprofile
に基づいて実⾏
deploy: lambda
に当てられた role
に基づいて実⾏
対応: serverless.yml
でlambda
に IAM
権限を設定
Slide 15
Slide 15 text
# you can add statements to the Lambda function's IAM Role here
iamRoleStatements:
- Effect: "Allow"
Action:
- "s3:ListBucket"
Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref"
- Effect: "Allow"
Action:
- "s3:PutObject"
Resource:
Fn::Join:
- ""
- - "arn:aws:s3:::"
- "Ref" : "ServerlessDeploymentBucket"
- "/*"
Slide 16
Slide 16 text
おまけ2
webpack
の話
Q. Node8.10
でES6
対応してるなら必要なくない?
A. module
依存の最適化とかで、有ったほうがいいから(震え声)
With babel/webpack you have the Node version independent
optimized packaging and tree-shaking, which just cannot be
done with plain Node8 and packaging everything in your
project root.
(https://forum.serverless.com/t/aws-node-8-10-runtime-for-
lambdas-migration-guide/4141)