Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
LambdaとSQLiteでシステム構築
Search
おがどら
January 23, 2025
Technology
560
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
LambdaとSQLiteでシステム構築
ECSやRDSは高いので、LambdaやEFSで代替してみました。
おがどら
January 23, 2025
More Decks by おがどら
See All by おがどら
任意のドメインを破壊
ogadra
0
44
hono-remix-adapter使ってみた
ogadra
0
390
Terraformと AWS Lambdaで WebSocket通信
ogadra
1
260
Other Decks in Technology
See All in Technology
Agent Skills設計で柔軟性と硬さのバランスが難しい話
nassy20
0
120
Bucharest Tech Week 2026 - Reinventing testing practices in the AI era
edeandrea
PRO
1
140
生成 AI × MCP で切り拓く次世代 SRE!自律型運用への挑戦と開発者体験の進化
_awache
0
190
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.9k
地球に⽣きるAI —GeoAIと「中間領域」— / AI Living on Earth — GeoAI and the “Intermediate Layer” —
ykiyota
0
280
SONiC Scale-Up Working Group から探る Scale-UpやUltraEthernet機能の実装方法
ebiken
PRO
0
110
200個のGitHubリポジトリを横断調査したかった
icck
0
110
Claude Code×Terraform IaC テンプレート駆動開発
itouhi
1
490
失敗を経て、Harness Engineering で 大切にしたいことを考える / Learning from Failure: What Matters in Harness Engineering
bitkey
PRO
1
300
フロンティアAIのゲート化と地政学リスク
nagatsu
0
120
AIの性能が向上しても未解決な組織の重大問題は何か?/An Unsolved Organizational Problem in the Age of AI
moriyuya
3
610
小さくはじめるSLI/SLO ~育てながら組織に定着させる実践知~ / Starting Small with SLI/SLOs: Building Adoption Through Continuous Growth
nari_ex
4
1.7k
Featured
See All Featured
Site-Speed That Sticks
csswizardry
13
1.2k
Bash Introduction
62gerente
615
220k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
330
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Side Projects
sachag
455
43k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
The browser strikes back
jonoalderson
0
1.2k
Thoughts on Productivity
jonyablonski
76
5.2k
Done Done
chrislema
186
16k
Ruling the World: When Life Gets Gamed
codingconduct
0
250
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.6k
Transcript
Lambda とSQLite でシステム構築 おがどら
みなさん
RDS 、高すぎますよね
小規模のアプリケーションにRDS はオーバースペ ックすぎる
そこで、EFS とSQLite を使ってお安くアプリを作 成したので、ご紹介します こちらは2024 年4 月に作成しました
背景 Next.js + Prisma のアプリケーションを作って みた ECS もRDS も 高
す ぎ る 社内システムなので、可用性とかスペック とかいらない EC2 すら高い でもDocker もRDB も使いたい
結論
コストカットのための構成 RDS -> EFS 上のSQLite ECS -> VPC Lambda ALB
-> API Gateway
RDS -> SQLite on EFS PostgreSQL にしかない機能を SQLite 向けに 変更
概ねPrisma ORM がいい感じにしてくれる
Lambda から EFS にアクセス VPC Lambda として作成する EFS マウントターゲットを同一AZ に作成する
ECS -> Lambda Dockerfile にこの1 行を追加するだけ 👇🏻👇🏻 ( 紙面の都合上改行しています) COPY
--from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.0 \ /lambda-adapter /opt/extensions/lambda-adapter
VPC Lambda はWAN に出られない ENI にEIP を割り当てる必要ががある aws ec2 associate-address
\ --allocation-id $allocationId \ --network-interface-id $nicId
コスト削減効果 ECS / RDS を使うときに比べて90% 削減 月額 50 ドル →
4 ドル 移行前) ELB 18 ドル + RDS 21 ドル + ECS 11 ドル 移行後) EIP 3.6 ドル + EFS 0.4 ドル
この構成のメリット Docker の用意の手間が少ない 開発環境との差分が1 行 SQLite が使える Prisma のデフォルトDB はSQLite
初期セットアップの手間が少ない 意外と安定している 半年以上運用しているが、障害はない
この構成のデメリット インフラ用意はちょっと大変 個人開発にはオススメ 同時にSQLite に書き込むとSQLite が壊れる? NFS 上のファイルには書き込みロックがか からないため 書き込みがほぼないため無問題
まとめ 安いアーキテクチャを考えるのは楽しい!
ご清聴ありがとうございました Twitter: GitHub: @const_myself ogadra made by reveal.js