Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Application development with AWS Lambda and Kotlin
Search
Hiroyuki Kusu
April 05, 2021
Programming
0
590
Application development with AWS Lambda and Kotlin
Kotlin Tech Talk (
https://mercari.connpass.com/event/206751/
) の資料
Hiroyuki Kusu
April 05, 2021
Tweet
Share
More Decks by Hiroyuki Kusu
See All by Hiroyuki Kusu
モノレポのプルリクエストに最近、導入したもの
hkusu
2
410
GitHub composite actions
hkusu
2
280
Android の静的解析における SARIF ファイルの活用
hkusu
0
4.4k
CI_でライブラリのバージョンの変化をレポートする.pdf
hkusu
0
290
Maestro を GitHub Actions で動かす 〜Android編〜
hkusu
0
1.2k
Android の CI(GitHub Actions)の改善で、最近やったこと
hkusu
0
540
Tauri Mobile で生成される Android のコードを見てみる
hkusu
0
1.3k
Custom GitHub Actions を作って Organization 内で共有する
hkusu
1
470
GitHub Actions でユニットテストの結果をレポートする
hkusu
0
3.2k
Other Decks in Programming
See All in Programming
Modular Monolith Monorepo ~シンプルさを保ちながらmonorepoのメリットを最大化する~
yuisakamoto
11
3.9k
AWS認定資格を勉強した先に何があったか
satoshi256kbyte
2
180
layerx_20241129.pdf
kyoheig3
2
250
Cognitoが大型アップデート!Managed Loginとパスワードレスログインを実際に使ってみた@しむそくRadio Special Day1
tmhirai
3
230
社内活動の取り組み紹介 ~ スリーシェイクでこんな取り組みしてます ~
bells17
0
380
Seamless Flutter Native Integration: FFI & Pigeon - Dreamwalker (JaichangPark / 박제창) @FlutterKaigi2024
itsmedreamwalker
0
110
macOS なしで iOS アプリを開発する(※ただし xxx に限る)
mitsuharu
1
170
気をつけたい!Desktop対応で陥りやすい罠とその対策
goto_tsl
0
190
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
4
510
Java 23の概要とJava Web Frameworkの現状 / Java 23 and Java web framework
kishida
2
380
新規学習のハードルを下げる方法とは?/ How to Make Learning Something New Easier?
nobuoooo
1
130
[FlutterKaigi2024] Effective Form 〜Flutterによる複雑なフォーム開発の実践〜
chocoyama
1
3.9k
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
95
5.2k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Visualization
eitanlees
145
15k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Typedesign – Prime Four
hannesfritz
40
2.4k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
KATA
mclloyd
29
14k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Transcript
Application development with AWS Lambda and Kotlin 2021.04.05 Kotlin Tech
Talk #merpay_techtalk Hiroyuki Kusu ( @hkusu_ )
About me
https://aws.amazon.com/jp/lambda/ ݱ࣌Ͱ Java Java 8 ͱ Java 11 ͕͑Δ
"1*(BUFXBZ )551 ఆظ࣮ߦ -BNCEB +BWB,PUMJO ͷΤίγεςϜ *P5 4/4 4 %ZOBNP%#
"84ϦιʔεΛར༻ )551 ҙͷαʔϏεΛར༻ ʢ(JU)VC"1* 4MBDL"1* FUDʣ "84Ϧιʔε͔Βىಈ )551Ͱىಈ
"1*(BUFXBZ )551 ఆظ࣮ߦ -BNCEB +BWB,PUMJO ͷΤίγεςϜ *P5 4/4 4 %ZOBNP%#
"84ϦιʔεΛར༻ )551 ҙͷαʔϏεΛར༻ ʢ(JU)VC"1* 4MBDL"1* FUDʣ "84Ϧιʔε͔Βىಈ )551Ͱىಈ
"1*(BUFXBZ )551 ఆظ࣮ߦ -BNCEB +BWB,PUMJO ͷΤίγεςϜ *P5 4/4 4 %ZOBNP%#
"84ϦιʔεΛར༻ )551 ҙͷαʔϏεΛར༻ ʢ(JU)VC"1* 4MBDL"1* FUDʣ "84Ϧιʔε͔Βىಈ )551Ͱىಈ
"1*(BUFXBZ )551 ఆظ࣮ߦ -BNCEB +BWB,PUMJO ͷΤίγεςϜ *P5 4/4 4 %ZOBNP%#
"84ϦιʔεΛར༻ )551 ҙͷαʔϏεΛར༻ ʢ(JU)VC"1* 4MBDL"1* FUDʣ "84Ϧιʔε͔Βىಈ )551Ͱىಈ
"1*(BUFXBZ )551 ఆظ࣮ߦ -BNCEB +BWB,PUMJO ͷΤίγεςϜ *P5 4/4 4 %ZOBNP%#
"84ϦιʔεΛར༻ )551 ҙͷαʔϏεΛར༻ ʢ(JU)VC"1* 4MBDL"1* FUDʣ "84Ϧιʔε͔Βىಈ )551Ͱىಈ
"1*(BUFXBZ )551 ఆظ࣮ߦ -BNCEB +BWB,PUMJO ͷΤίγεςϜ *P5 4/4 4 %ZOBNP%#
"84ϦιʔεΛར༻ )551 ҙͷαʔϏεΛར༻ ʢ(JU)VC"1* 4MBDL"1* FUDʣ "84Ϧιʔε͔Βىಈ )551Ͱىಈ ͜ͷ͋ͨΓ͕͋ΕϘοτӡ༻πʔϧྨͷϗεςΟϯάڥͱͯ͠े
IDE IntelliJ IDEA Λར༻ ( Community ൛ͳΒແঈ ) ͠ɺ
Java Kotlin ͷϓϩδΣΫτςϯϓϨʔτΛ͏ͱ࢝Ί͍͢
task buildZip(type: Zip) { from compileKotlin from processResources into('lib') {
from configurations.compileClasspath } } build.dependsOn buildZip Kotlin ͷίʔυΛϏϧυ͢Δ Gradle λεΫ ./gradlew build Gradle ίϚϯυͰϏϧυ
※ SAM( Serverless Application Model ) CloudFormation ͰσϓϩΠ͍͍ͯ͠Ͱ͢ ཧίϯιʔϧ
ϏϧυͰੜ͞Εͨ zip ϑΝΠϧΛ AWS ͷཧίϯιʔϧΞοϓϩʔυ
// Kotlin implementation “org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72” implementation “org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3” // Network implementation "com.squareup.retrofit2:retrofit:2.7.1"
implementation "com.squareup.retrofit2:converter-moshi:2.6.0" implementation "com.squareup.moshi:moshi:1.8.0" implementation "com.squareup.moshi:moshi-kotlin:1.8.0" implementation “com.squareup.okhttp3:okhttp:4.3.1” implementation “com.squareup.okhttp3:logging-interceptor:4.3.1” // AWS implementation 'com.amazonaws:aws-lambda-java-core:1.1.0' ※ ਵલʹ࡞ͬͨπʔϧͷίʔυ͔ΒҾ༻ͨ͠ͷͰ֤όʔδϣϯͪΐͬͱݹ͍Ͱ͢.. ҙͷϥΠϒϥϦ͕ར༻Ͱ͖Δ
// Kotlin implementation “org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72” implementation “org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3” // Network implementation "com.squareup.retrofit2:retrofit:2.7.1"
implementation "com.squareup.retrofit2:converter-moshi:2.6.0" implementation "com.squareup.moshi:moshi:1.8.0" implementation "com.squareup.moshi:moshi-kotlin:1.8.0" implementation “com.squareup.okhttp3:okhttp:4.3.1” implementation “com.squareup.okhttp3:logging-interceptor:4.3.1” // AWS implementation 'com.amazonaws:aws-lambda-java-core:1.1.0' ※ ਵલʹ࡞ͬͨπʔϧͷίʔυ͔ΒҾ༻ͨ͠ͷͰ֤όʔδϣϯͪΐͬͱݹ͍Ͱ͢.. ҙͷϥΠϒϥϦ͕ར༻Ͱ͖Δ
package io.github.hkusu.githubrepositoryreport import com.amazonaws.services.lambda.runtime.Context import com.amazonaws.services.lambda.runtime.RequestHandler class Handler : RequestHandler<Input,
Output> { override fun handleRequest(input: Input, context: Context): Output { // do something ... return Output(statusCode = 200, body = "OK") } } // API Gateway ͷ Lambda ϓϩΩγ౷߹ͷ߹ data class Input(var body: String? = null) // varͰσϑΥϧτ͕ඞཁ data class Output(val statusCode: Int, val body: String)
package io.github.hkusu.githubrepositoryreport import com.amazonaws.services.lambda.runtime.Context import com.amazonaws.services.lambda.runtime.RequestHandler class Handler : RequestHandler<Input,
Output> { override fun handleRequest(input: Input, context: Context): Output { // do something ... return Output(statusCode = 200, body = "OK") } } // API Gateway ͷ Lambda ϓϩΩγ౷߹ͷ߹ data class Input(var body: String? = null) // varͰσϑΥϧτ͕ඞཁ data class Output(val statusCode: Int, val body: String)
package io.github.hkusu.githubrepositoryreport import com.amazonaws.services.lambda.runtime.Context import com.amazonaws.services.lambda.runtime.RequestHandler class Handler : RequestHandler<Input,
Output> { override fun handleRequest(input: Input, context: Context): Output { // do something ... return Output(statusCode = 200, body = "OK") } } // API Gateway ͷ Lambda ϓϩΩγ౷߹ͷ߹ data class Input(var body: String? = null) // varͰσϑΥϧτ͕ඞཁ data class Output(val statusCode: Int, val body: String) Input().body = "<JSONจࣈྻ>"
https://github.com/hkusu/aws-lambda-templete-for-kotlin AWS Lambda x Kotlin ϓϩδΣΫτͷςϯϓϨʔτ
Thank you ! @hkusu_
API Gateway Λ͏߹ Lambda ϓϩΩγ౷߹ʹ͓ͯ͘͠ͱ Lambda ͷೖग़ྗ͕ѻ͍͘͢ͳΔ
Lambda ͷϋϯυϥͷઃఆྫ ( ΫϥεͷϑϧύεΛࢦఆ͢Δ )
γʔΫϨοτͳͷڥมઃఆ