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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
おがどら
January 23, 2025
Technology
1
440
LambdaとSQLiteでシステム構築
ECSやRDSは高いので、LambdaやEFSで代替してみました。
おがどら
January 23, 2025
Tweet
Share
More Decks by おがどら
See All by おがどら
任意のドメインを破壊
ogadra
0
34
hono-remix-adapter使ってみた
ogadra
0
370
Terraformと AWS Lambdaで WebSocket通信
ogadra
1
250
Other Decks in Technology
See All in Technology
Cosmos World Foundation Model Platform for Physical AI
takmin
0
970
SREのプラクティスを用いた3領域同時 マネジメントへの挑戦 〜SRE・情シス・セキュリティを統合した チーム運営術〜
coconala_engineer
2
770
StrandsとNeptuneを使ってナレッジグラフを構築する
yakumo
1
120
AzureでのIaC - Bicep? Terraform? それ早く言ってよ会議
torumakabe
1
600
制約が導く迷わない設計 〜 信頼性と運用性を両立するマイナンバー管理システムの実践 〜
bwkw
3
1k
(技術的には)社内システムもOKなブラウザエージェントを作ってみた!
har1101
0
150
20260204_Midosuji_Tech
takuyay0ne
1
160
GitHub Issue Templates + Coding Agentで簡単みんなでIaC/Easy IaC for Everyone with GitHub Issue Templates + Coding Agent
aeonpeople
1
260
Context Engineeringが企業で不可欠になる理由
hirosatogamo
PRO
3
660
コンテナセキュリティの最新事情 ~ 2026年版 ~
kyohmizu
6
1.4k
Agile Leadership Summit Keynote 2026
m_seki
1
670
pool.ntp.orgに ⾃宅サーバーで 参加してみたら...
tanyorg
0
570
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Designing for Performance
lara
610
70k
The SEO identity crisis: Don't let AI make you average
varn
0
330
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.2k
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
The Curse of the Amulet
leimatthew05
1
8.7k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
117
110k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.3k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
170
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.4k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
130
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