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
1
480
LambdaとSQLiteでシステム構築
ECSやRDSは高いので、LambdaやEFSで代替してみました。
おがどら
January 23, 2025
Tweet
Share
More Decks by おがどら
See All by おがどら
任意のドメインを破壊
ogadra
0
37
hono-remix-adapter使ってみた
ogadra
0
380
Terraformと AWS Lambdaで WebSocket通信
ogadra
1
260
Other Decks in Technology
See All in Technology
Phase12_総括_自走化
overflowinc
0
1.2k
Phase03_ドキュメント管理
overflowinc
0
2.1k
モジュラモノリス導入から4年間の総括:アーキテクチャと組織の相互作用について / Architecture and Organizational Interaction
nazonohito51
3
1.5k
Agent Skill 是什麼?對軟體產業帶來的變化
appleboy
0
200
詳解 強化学習 / In-depth Guide to Reinforcement Learning
prinlab
0
360
脳が溶けた話 / Melted Brain
keisuke69
0
690
Phase04_ターミナル基礎
overflowinc
0
1.9k
開発チームとQAエンジニアの新しい協業モデル -年末調整開発チームで実践する【QAリード施策】-
kaomi_wombat
0
230
FastMCP OAuth Proxy with Cognito
hironobuiga
3
130
_Architecture_Modernization_から学ぶ現状理解から設計への道のり.pdf
satohjohn
2
700
生成AI活用でQAエンジニアにどのような仕事が生まれるか/Support Required of QA Engineers for Generative AI
goyoki
1
370
Tebiki Engineering Team Deck
tebiki
0
27k
Featured
See All Featured
Paper Plane
katiecoart
PRO
0
48k
Typedesign – Prime Four
hannesfritz
42
3k
Designing for Performance
lara
611
70k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
480
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
280
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
Optimizing for Happiness
mojombo
378
71k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
860
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
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