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
400
GitHub composite actions
hkusu
2
270
Android の静的解析における SARIF ファイルの活用
hkusu
0
4.1k
CI_でライブラリのバージョンの変化をレポートする.pdf
hkusu
0
280
Maestro を GitHub Actions で動かす 〜Android編〜
hkusu
0
1.2k
Android の CI(GitHub Actions)の改善で、最近やったこと
hkusu
0
540
Tauri Mobile で生成される Android のコードを見てみる
hkusu
0
1.2k
Custom GitHub Actions を作って Organization 内で共有する
hkusu
1
460
GitHub Actions でユニットテストの結果をレポートする
hkusu
0
3.2k
Other Decks in Programming
See All in Programming
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
190
最新TCAキャッチアップ
0si43
0
140
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
Contemporary Test Cases
maaretp
0
130
Better Code Design in PHP
afilina
PRO
0
120
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.7k
Macとオーディオ再生 2024/11/02
yusukeito
0
370
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Navigating Team Friction
lara
183
14k
Building an army of robots
kneath
302
43k
How GitHub (no longer) Works
holman
310
140k
Building Your Own Lightsaber
phodgson
103
6.1k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Become a Pro
speakerdeck
PRO
25
5k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Speed Design
sergeychernyshev
24
610
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 ͷϋϯυϥͷઃఆྫ ( ΫϥεͷϑϧύεΛࢦఆ͢Δ )
γʔΫϨοτͳͷڥมઃఆ