Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
LambdaとSQLiteでシステム構築
Search
おがどら
January 23, 2025
Technology
610
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
59
hono-remix-adapter使ってみた
ogadra
0
400
Terraformと AWS Lambdaで WebSocket通信
ogadra
1
270
Other Decks in Technology
See All in Technology
AgentCore Runtime上にAgentic Coding基盤を構築・展開する際の設計ポイントと限界点 / Design considerations and limitations when building an agentic coding platform on AgentCore Runtime
har1101
5
370
Reactの設計論
uhyo
24
14k
品質と信頼性を地続きにする
grimoh
2
810
「ピッケル本」日本語版は4.0(第6版)が出版されるべき / pickaxe4-nagoyark05
kakutani
2
190
AI時代、データエンジニアが一番おもろい
genshun9
0
670
今話題のAI「Jev」って何? 宇宙最速で学ぶ会
minorun365
PRO
30
16k
AI時代の「技術的負債」の変質ー概念の終焉と再解釈、エージェントと共に向かう先
nwiizo
1
2.9k
AIエージェントの権限管理 3: Agentic RAG の Fine grained access control 編
ren8k
0
140
積み重なった技術負債への挑戦 〜初手としての全社ゴト化〜
techtekt
PRO
0
1.4k
What the customer really needed
kawaguti
PRO
3
210
アプリをもっと"iOSアプリっぽく"する小さな工夫 / Small Touches That Make Your App Feel More Like an iOS App
matsuji
2
960
.NET WebAssemblyで実現するクライアントサイドAI推論:NuGetからViteまで、2つのエコシステムを繋ぐビルド戦略
yamachu
0
210
Featured
See All Featured
How to Ace a Technical Interview
jacobian
281
24k
How to make the Groovebox
asonas
2
2.4k
How to Talk to Developers About Accessibility
jct
2
550
Ethics towards AI in product and experience design
skipperchong
2
380
Rails Girls Zürich Keynote
gr2m
96
14k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
65k
Everyday Curiosity
cassininazir
0
320
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
610
Building the Perfect Custom Keyboard
takai
2
880
A designer walks into a library…
pauljervisheath
211
25k
Practical Orchestrator
shlominoach
192
12k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
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