Weitere ähnliche Inhalte
Ähnlich wie Future tech night #12~goで始めるサーバレスファーストという選択肢~ (20)
Future tech night #12~goで始めるサーバレスファーストという選択肢~
- 29. 開発イメージ
実装が完了したらデプロイ
ビルド、zip圧縮、デプロイのコマンドはMakefileに記載する
#############
# Build
#############
deps:
go mod download
go mod tidy
build: deps
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -buildid= -X main.version=$(shell git describe --abbrev=0 --tags) -X main.revision=$(shell git rev-parse HEAD)" -
trimpath -o ./bin/lambda ./cmd/lambda/lambda.go
#############
# Deployment
#############
zip: build
zip -j bin/lambda.zip bin/lambda
# update lambda function. if you wanna create new function, do not use belows.
deploy-dev: zip
aws lambda update-function-code --profile dev --region ap-northeast-1 --function-name dev-func --zip-file fileb://bin/lambda.zip
deploy-stg: zip
aws lambda update-function-code --profile stg --region ap-northeast-1 --function-name stg-func --zip-file fileb://bin/lambda.zip
deploy-prod: zip
aws lambda update-function-code --profile prod --region ap-northeast-1 --function-name prod-func --zip-file fileb://bin/lambda.zip
- 39. 業務でサーバレス を採用すると
● コストの話
○ 本番環境だけで119個のLambda関数を運用
○ そのうち50個弱がStepFunctionsで
24時間常に実行されている
○ EC2インスタンスはt2.microが2台
(踏み台サーバーとして利用)
- 40. 業務でサーバレス を採用すると
● コストの話
○ Lambdaの料金は約3万円/月
○ Step Functionsが高い、12万円/月
○ EC2ならt3.largeで8845円/月、t3.xlargeで17604円/月
サーバー2~4台分で119機能持ってると考えるとお買い得か