serverless frameworkを使っ
てみた話
2017.07.15 nseg #90 於 GEEKLAB.NAGANO
自己紹介
にしざわこういち
@koty
GEEKLAB.NAGANO 管理人見習い
SIer(Javaとか.NETとか)→現職(Python/Django/AWS)
FaaS: Function as a Service
関数実行基盤
最近よく耳にする
AWS Lambda
AWSのFaaS
node/Java/C#(.NET Core)/Python を使用可能
サーバーレス≒デーモンレス
状態を持たず、callされるたびにプロセスが上がっては落ちる(実際にはちょっと違う)
http://docs.aws.amazon.com/ja_jp/lambda/latest/dg/welcome.html
AWS Lambda
実体はAmazon LinuxのEC2
http経由でcallしたい場合は、API-Gatewayを通す必要がある
AWS Lambda
API Gatewayの他にも様々な起動トリガーを使える
CloudWatch Eventsによるcron実行が便利
ちょっとした定期実行処理のためのEC2が不要に
deployが面倒
簡単な処理(EC2を起動するとか)であれば、AWS管理コンソールに直接処
理を書けば良い
外部パッケージを使うときは、当該パッケージを含むzipを作る必要がある
面倒。herokuのようにrequirements.txt(rubyで言うgemfile)をプラットフ
ォーム側でダウンロードしてほしい
deployツールを使う
https://serverless.com
“The Serverless Framework is a CLI tool that
allows users to build & deploy auto-scaling,
pay-per-execution, event-driven functions.”
install〜deploy
npm install -g serverless
serverless create -t aws-python3 -p serverless-test
vim ~/.aws/credentials
serverless deploy --aws-profile koty
実行してみる
serverless invoke -f hello --aws-profile koty
サーバーはあった
/tmp に書き込んでみる
requirements.txt を含むアプリのdeploy
までは至らず

Serverless frameworkを使ってみた話 at #nseg #90