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
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
290
Android の静的解析における SARIF ファイルの活用
hkusu
0
4.6k
CI_でライブラリのバージョンの変化をレポートする.pdf
hkusu
0
290
Maestro を GitHub Actions で動かす 〜Android編〜
hkusu
0
1.2k
Android の CI(GitHub Actions)の改善で、最近やったこと
hkusu
0
550
Tauri Mobile で生成される Android のコードを見てみる
hkusu
0
1.3k
Custom GitHub Actions を作って Organization 内で共有する
hkusu
1
480
GitHub Actions でユニットテストの結果をレポートする
hkusu
0
3.2k
Other Decks in Programming
See All in Programming
Security_for_introducing_eBPF
kentatada
0
110
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
5
900
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
920
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
From Translations to Multi Dimension Entities
alexanderschranz
2
130
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
Recoilを剥がしている話
kirik
5
6.6k
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
890
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
Zoneless Testing
rainerhahnekamp
0
120
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
The Cult of Friendly URLs
andyhume
78
6.1k
The Pragmatic Product Professional
lauravandoore
32
6.3k
Designing for humans not robots
tammielis
250
25k
Writing Fast Ruby
sferik
628
61k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Mobile First: as difficult as doing things right
swwweet
222
9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Designing Experiences People Love
moore
138
23k
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 ͷϋϯυϥͷઃఆྫ ( ΫϥεͷϑϧύεΛࢦఆ͢Δ )
γʔΫϨοτͳͷڥมઃఆ