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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
おがどら
January 23, 2025
Technology
630
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
63
hono-remix-adapter使ってみた
ogadra
0
410
Terraformと AWS Lambdaで WebSocket通信
ogadra
1
270
Other Decks in Technology
See All in Technology
Cognition AI Japan - ウェビナー2_テストQA_運用監視
cogakira
0
140
Jetson Orin Nanoとk3sとローカルLLMで音声文字起こしシステム作ってみた
y_sera15
0
120
二歩目のフロントエンド・ウェブアクセシビリティ
camiha
2
440
Loop Engineering, beyond prompt, context, and harness engineering
glaforge
0
100
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
880
その Valkey 使いこなしていますか?
onk
PRO
4
650
パッチ更新でterraform initが落ちた日
grimoh
1
130
メルペイ 会計システム概要と歴史
mewuto
1
220
「Docker Desktop不要の時代」は 来たのか?
ueponx
0
630
ai_cording_with_k8s_knowledge.pdf
mochizuki875
1
350
遠藤な_めぐろLT #38 「社内のAI活用推進」@麻布台_20261009
endonanana
0
120
FOSS4Gを活用した自治体業務DXの試み
470715
0
150
Featured
See All Featured
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
800
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
320
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
Un-Boring Meetings
codingconduct
0
450
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
730
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
550
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
Technical Leadership for Architectural Decision Making
baasie
3
600
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
HDC tutorial
michielstock
2
960
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