generated at
Serverless Framework
AWS Lambdaで開発環境を作るLibrary


v4から有償化するらしい


template作成
python
$ sls create -t aws-python -p hogehoge
nodejs
$ sls create -t aws-nodejs -p hogehoge
typescript



Localで動かす
準備 ref
serverless.ymlに以下を追加
serverless.yml
plugins: - serverless-offline
$ npm i serverless-offline -D
$ sls offline
起動
$ sls offline --printOutput
console.logをターミナルに出力


serverless.ymlを修正する
どの関数を実行するかとかの指定をする


deploy
$ sls deploy -v
先にserverless.ymlを設定しておく
region とか間違っていると表示されなかったりする
実行後に表示されるendpointsの末尾にpathを入れてアクセスするとみれる
e.g. https://hogehoge.amazonaws.com/dev/hello
よくあるエラー
Member must have length less than or equal to 64
roll nameが64文字以上あるとdeployに失敗する
roll nameは <name>+handler/hello みたいなやつ



deploy後に関数を実行してテストする
$ sls invoke -f hello