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
420
GitHub composite actions
hkusu
2
290
Android の静的解析における SARIF ファイルの活用
hkusu
0
4.6k
CI_でライブラリのバージョンの変化をレポートする.pdf
hkusu
0
300
Maestro を GitHub Actions で動かす 〜Android編〜
hkusu
0
1.3k
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.3k
Other Decks in Programming
See All in Programming
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
170
Beyond ORM
77web
10
1.4k
DevFest - Serverless 101 with Google Cloud Functions
tunmise
0
130
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
6
480
Оптимизируем производительность блока Казначейство
lamodatech
0
770
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
1
300
Zoneless Testing
rainerhahnekamp
0
130
Online-Dokumentation, die hilft: Strukturen, Prozesse, Tools
ahus1
0
100
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
110
php-conference-japan-2024
tasuku43
0
380
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
690
React 19でお手軽にCSS-in-JSを自作する
yukukotani
5
450
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Making Projects Easy
brettharned
116
6k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Rails Girls Zürich Keynote
gr2m
94
13k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
The Language of Interfaces
destraynor
155
24k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Navigating Team Friction
lara
183
15k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Git: the NoSQL Database
bkeepers
PRO
427
64k
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 ͷϋϯυϥͷઃఆྫ ( ΫϥεͷϑϧύεΛࢦఆ͢Δ )
γʔΫϨοτͳͷڥมઃఆ