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
Kotlinでサーバーレス! 「Kotless」の紹介
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
h.isoe
September 29, 2021
Programming
590
1
Share
Kotlinでサーバーレス! 「Kotless」の紹介
サーバーレス LT #r_serverlesslt
https://rakus.connpass.com/event/221200/
上記のLT登壇で利用したスライドです。
h.isoe
September 29, 2021
More Decks by h.isoe
See All by h.isoe
コードレビューで開発を止めないために
ih6109
0
110
AIを「完全に理解」するG検定合格体験記
ih6109
1
180
Go言語のモジュール管理_完全に理解した
ih6109
0
300
2022_07_14_おすすめの技術書 LT会 - vol.4_ 問題解決を仕事にする 全ての人へ
ih6109
0
120
2021_08_19 おすすめの技術書 LT会 - vol.2 Vue.js3超入門がとにかくやさしい
ih6109
0
22k
Other Decks in Programming
See All in Programming
Claude Codeをカスタムして自分だけのClaude Codeを作ろう
terisuke
0
150
AI-DLC Deep Dive
yuukiyo
9
4.8k
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
4
1.2k
「Linuxサーバー構築標準教科書」を読んでみた #ツナギメオフライン.7
akase244
0
1.4k
Claude Code × Gemini × Ebitengine ゲーム制作素人WebエンジニアがGoでゲームを作った話
webzawa
0
160
アクセシビリティ試験の"その後"を仕組み化する
yuuumiravy
1
170
実用!Hono RPC2026
yodaka
2
270
AWSコミュニティ活動は顧客のクラウド推進に効くのか / Do AWS community activities help customers adopt the cloud?
seike460
PRO
0
150
事業会社でのセキュリティ長期インターンについて
masachikaura
1
270
Agentic Elixir
whatyouhide
0
410
2026_04_15_量子計算をパズルとして解く
hideakitakechi
0
110
GoogleCloudとterraform完全に理解した
terisuke
1
160
Featured
See All Featured
The Invisible Side of Design
smashingmag
303
52k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Mobile First: as difficult as doing things right
swwweet
225
10k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.1k
Six Lessons from altMBA
skipperchong
29
4.2k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
210
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.5k
Side Projects
sachag
455
43k
Are puppies a ranking factor?
jonoalderson
1
3.3k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
70
39k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
150
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
190
Transcript
Kotlinでサーバーレス! 「Kotless」の紹介 2021/09/29 サーバーレス LT 磯江 宏由紀
自己紹介 ❖ 磯江 宏由紀(Twitter:@ihirhs) ➢ 虎の穴ラボ株式会社 ▪ 通販サイトの開発 ▪ ファンクラブプラットフォームサービスの開発
➢ Java、Kotlinを利用したサーバサイド開発 ➢ 直近一ヶ月はRailsとVue.jsの開発! ❖ サーバーレスやりたい! ➢ 今のスキルも活かしたい! ➢ Kotlessがあるじゃないか! 2
アジェンダ ❖ Kotlessってなに? ➢ 仕組み ➢ 利用に必要なもの ➢ 構成 ❖
アプリケーションを定義する ❖ デプロイ設定を定義する ❖ Kotlessのオススメポイント ❖ Kotlessを利用する上での注意点 3
Kotlessってなに? ❖ Kotlin製のサーバーレスフレームワーク ➢ アプリケーションの開発に注力するためのフレームワーク ❖ アプリケーションのコードからデプロイに必要なTerraformのコードを生成 ❖ ローカルでの動作確認からデプロイまで可能 ❖
ver0.1.6現在、AWSでのみ対応 ❖ 次バージョン0.2.0でMicrosoft Azure 4
Kotlessの仕組み 5
❖ AWSアカウント ➢ +AWS Command Line Interfaceの導入 ❖ アプリケーションを公開するためのRoute53で管理しているDNSゾーン ❖
Kotlessアーティファクトを保存しておくS3バケット ❖ AWS Certificate Managerの証明書 ❖ デプロイするコード Kotlessを利用するために必要なもの 6
Kotlessの構成 ❖ アプリケーションを定義する ➢ Kotless DSL ▪ フレームワーク独自の記法でコーディング ➢ Ktor
▪ サーバーサイドKotlinのフレームワーク「Ktor」の記法でコーディング ➢ Spring Boot ▪ アノテーションを利用してルーティングを設定 ❖ デプロイ設定を定義する ➢ Gradleプラグイン ▪ 利用するS3バケットやDNSなどを設定 ▪ ローカル実行やデプロイなどの Gradleタスクを提供 7
アプリケーションを定義する(Kotless DSL) ❖ アノテーションでルーティング 8 @Get("/") fun main() = "Hello
world!"
アプリケーションを定義する(Ktor) ❖ Kotlessを継承して、prepareメソッドをOverride ❖ ルーティングとレスポンスはKtorの記法 9 class Server : Kotless()
{ override fun prepare(app: Application) { app.routing { get("/") { call.respondText { "Hello World!" } } } } }
アプリケーションを定義する(Spring Boot) ❖ Kotlessを継承して、bootKlassをOverride ❖ ルーティングはSpring Bootの記法 10 @SpringBootApplication open
class Application : Kotless() { override val bootKlass: KClass<*> = this::class } @RestController object Pages { @GetMapping( "/") fun main() = "Hello World!" }
デプロイ設定を定義する(build.gradle.kts) 11 kotless { config { bucket = "kotless.s3.example.com" //
利用するS3バケット terraform { profile = "example" // AWS CLIのプロファイル region = "us-east-1" } } webapp { // アプリケーションを公開するドメイン route53 = Route53("kotless", "example.com") } }
デプロイする Gradleタスクの「deploy」を実行するだけ 12
Kotlessのオススメポイント ❖ アプリケーションの開発に専念できる ❖ Ktor、SpringBootなどサーバーサイドKotlinの知見を活用できる ❖ ローカルでの動作確認ができる 13
Kotlessを利用する上での注意点 ❖ まだメジャーバージョンがリリースされていない ➢ 実装が大きく変わるかも? ❖ 一般公開したくない場合には、ひと手間必要 ❖ デプロイしてしまうとAWS費用がかかります ➢
自分の場合はS3、Route53で$1/月 14
Kotless関連のリンク https://github.com/JetBrains/kotless https://site.kotless.io/ 15