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
Amplify Meetup #01
Search
Taewoo Kim
July 31, 2020
Programming
1
6.3k
Amplify Meetup #01
AWS Amplify Meetup #01 で LT 発表したスライドです。
Taewoo Kim
July 31, 2020
Tweet
Share
More Decks by Taewoo Kim
See All by Taewoo Kim
AWS Lambda 내부동작 파헤치기
twkiiim
1
2.6k
Amazon VPC Deep Dive: ENI 를 알면 VPC 가 보인다
twkiiim
2
5.3k
온라인 주문 서비스를 서버리스 아키텍쳐로 구축하기
twkiiim
0
380
Amazon EventBridge vs Amazon SNS
twkiiim
0
2.1k
活用パターンで学ぶGraphQL
twkiiim
0
1.3k
AWS 기반 서버리스 아키텍쳐 톺아보기
twkiiim
0
2k
AWS 기반 서버리스 아키텍쳐 톺아보기
twkiiim
1
2.9k
AppSync를 활용한 리얼타임 서버리스 아키텍쳐
twkiiim
0
4.4k
[LINE API × Tech API Vol. 2 Powered by AWS] サーバーレスでの分散トランザクション
twkiiim
0
2.3k
Other Decks in Programming
See All in Programming
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
310
CSC305 Lecture 25
javiergs
PRO
0
130
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
770
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
700
ドメインイベント増えすぎ問題
h0r15h0
1
230
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
170
Criando Commits Incríveis no Git
marcelgsantos
2
170
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
120
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
160
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
Featured
See All Featured
Become a Pro
speakerdeck
PRO
26
5k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Docker and Python
trallard
42
3.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Raft: Consensus for Rubyists
vanstee
137
6.7k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Adopting Sorbet at Scale
ufuk
73
9.1k
Transcript
AmplifyͷAPIػೳΛ͏ࡍͷTips Amplify Meetup #01 LT ηογϣϯ #05
ࣗݾհ • Taewoo Kim (ΩϜςʣɺؖࠃਓͰ͢ʂ • AWS Solutions Architect at
• 2020 APN AWS Top Engineers ʹબ • ͖ͳAWSαʔϏε AWS AppSync ͱ AWS Amplify
ຊηογϣϯͷର • AWS Amplify API ػೳΛҰͰ࣮ࡍʹࢼͯ͠Έͨํ • AWS Amplify νϡʔτϦΞϧΛΫϦΞʔͨ͠ํ
• AWS Amplify Λຊ൪ڥͰಋೖ͍ͨ͠ͱࢥ͏ํ
ૣͰ͕͢
օ͞Μ Amplifyͳͥͬͯ·͔͢ʁ
AmplifyΛ͏ཧ༝ • ָ͍͔͠Β • όοΫΤϯυଆͷ࣮ศརͩ͠ɺϑϩϯτଆͷָ࣮ʹͳΔ͔Β •ϏδωεΞΠσΟΞΛ۩ମԽͨ͠ॳظMVPΛ രͰ࣮Ͱ͖Δ͔Βʂ
AmplifyΛ͏ཧ༝ • ָ͍͔͠Β • όοΫΤϯυଆͷ࣮ศརͩ͠ɺϑϩϯτଆͷָ࣮ʹͳΔ͔Β •ϏδωεΞΠσΟΞΛ۩ମԽͨ͠ॳظMVPΛ രͰ࣮Ͱ͖Δ͔Βʂ
AmplifyΛ͏ཧ༝ • ָ͍͔͠Β • όοΫΤϯυଆͷ࣮ศརͩ͠ɺϑϩϯτଆͷָ࣮ʹͳΔ͔Β •ϏδωεΞΠσΟΞΛ۩ମԽͨ͠ॳظMVPΛ രͰ࣮Ͱ͖Δ͔Βʂ ݸਓతʹ͜ͷཧ༝(↑)͕Ұ൪େࣄͩͱࢥ͍·͢
AmplifyΛ͏ཧ༝ • ָ͍͔͠Β • όοΫΤϯυଆͷ࣮ศརͩ͠ɺϑϩϯτଆͷָ࣮ʹͳΔ͔Β •ϏδωεΞΠσΟΞΛ۩ମԽͨ͠ॳظMVPΛ രͰ࣮Ͱ͖Δ͔Βʂ ݸਓతʹ͜ͷཧ༝(↑)͕Ұ൪େࣄͩͱࢥ͍·͢ MVP࣮ͰAmplify͕Ұ൪ʹཱͭػೳ API
Amplify API Λ͍࢝Ίͨࡍʹ ඞ͓͍ͣͬͯͨํ͕ྑ͍ ϊϋΛڞ༗͠·͢
όοΫΤϯυϓϩδΣΫτ ϑϩϯτ͔Βͨ͠ํ͕ྑ͍
Ϟνϕʔγϣϯ • Amplify ެࣜυΩϡϝϯτΛݟΔͱɺϑϩϯτΤϯυϓϩδΣΫτͰ όοΫΤϯυϓϩδΣΫτΛҰॹʹཧ͢Δํ๏Λհ͍ͯ͠·͢ɻ • ͭ·ΓɺϑϩϯτΤϯυϓϩδΣΫτͷதʹɺamplify/ ͱ͍͏ϑΥ ϧμʔ͕ଘࡏ͢Δͱ͍͏ܗʹͳΓ·͢ɻ •
Ͱ͕͢ɺෳͷϓϩδΣΫτͰߏ͞Εͨ߹ɺ֤ϓϩδΣΫτʹ όοΫΤϯυઃఆΛೖΕΔͷ͕ਖ਼͍͠ͷ͔ɺͱ͍͏Έ͕͔ͪͱࢥ͍ ·͢ɻ
Ϟνϕʔγϣϯ • Amplify ެࣜυΩϡϝϯτΛݟΔͱɺϑϩϯτϓϩδΣΫτͰόο ΫΤϯυϓϩδΣΫτΛҰॹʹཧ͢Δํ๏Λհ͍ͯ͠·͢ɻ • ͭ·ΓɺϑϩϯτΤϯυϓϩδΣΫτͷதʹɺamplify/ ͱ͍͏ ϑΥϧμʔ͕ଘࡏ͢Δͱ͍͏ܗʹͳΓ·͢ɻ •
Ͱ͕͢ɺෳͷϓϩδΣΫτͰߏ͞Εͨ߹ɺ֤ϓϩδΣΫτ ʹόοΫΤϯυઃఆΛೖΕΔͷ͕ਖ਼͍͠ͷ͔ɺͱ͍͏Έ͕͔ͪͱ ࢥ͍·͢ɻ ͏Μ….. όοΫΤϯυผ్Ͱཧ͠·͠ΐ͏ʂ
όοΫΤϯυϓϩδΣΫτΛ͢Δ͜ͱͰಘΔϝϦοτ 1. όοΫΤϯυͱϑϩϯτͷSeparation of ConcernΛ࣮ݱ͍͢͠ 2. ෳͷϝϯόʔ͕Ұॹʹ࡞ۀ͘͢͠ͳΔ 3. কདྷతʹόοΫΤϯυϓϩδΣΫτΛϚΠάϨʔγϣϯ͢Δʹ ͬͱָʹͳΔ
όοΫΤϯυͱϑϩϯτΤϯυ͠·͠ΐ͏ʂ https://dev.classmethod.jp/articles/amplify-tips-series-1/
GraphQL Schemaͷ type ʹ @model Λ͚ͳ͔ͬͨ࣌ͷ ҙ͖͢͜ͱ
GraphQL Schemaͷ type ʹ @model Λ͚ͳ͔ͬͨ࣌ͷҙ͖͢͜ͱ https://dev.classmethod.jp/articles/amplify-tips-series-3/
ͦͦ @model Λͳ͚ͥͭͳ͍ΜͰ͔͢ʁʁ @model σΟϨΫςΟϒΛ͚ͭΔ͜ͱͷϝϦοτ 1. σʔλιʔε(DynamoDB) Λੜ͠ɺ AppSync ͱ࿈ܞͯ͘͠ΕΔɻ
2. Create/Read/Update/Delete/List ΦϖϨʔγϣϯΛಈ࡞ͤ͞ΔͨΊͷ Query Mutation ͱɺͦΕͧΕ͕ඞཁͱ͢Δ input ͷλΠϓΛࣗಈͰੜͯ͘͠ΕΔɻ 3. ੜ͞Εͨ Query MutationɺλΠϓϑΟʔϧυresolverͷͨΊͷ Request/Response Mapping TemplatesΛࣗಈͰੜͯ͘͠ΕΔɻ 4. ͜ͷΑ͏ʹੜ͞Εͨ CRUD(L) API ΛɺΫϥΠΞϯτιʔείʔυଆͰΞΫηεͰ͖Δ API ϥΠϒϥϦʔΛࣗಈͰੜͯ͘͠ΕΔɻ (amplify codegen)
@connection ͱ depth ͋ͨΓ • యܕతͳΞϓϦσʔλεΩϚʔͰඞཁͳλΠϓ͕ेʙඦ • λΠϓ͝ͱͷؔੑΛ࡞ΔͨΊʹ @connection ͕ඞཁ
• codegen ͷ depth ΛݮΒ͢··ҡ࣋͢ΔͨΊɺˏmodel Λফ͢ • ݁Ռతʹ @connection ແ͠ͰσʔλʹΞΫηεՄೳ
@model Λ͚ͭͳ͔ͬͨࡍͷҙʁ • @model Λ͚ͭͳ͍ͱɺͦͷ DynamoDB ςʔϒϧ͕ੜ͞Εͳ͍ • ଞͷ type
ͷςʔϒϧʹ JSON ܗࣜͰอଘ͞ΕΔ • DynamoDB JSON ෦ͷϑΟʔϧυʹରͯ͠ͷ Query αϙʔτ͠ ͯ͘Ε͍ͯͳ͍
@model Λ͚ͭͳ͔ͬͨࡍͷҙʁ • ͳͷͰɺdepth ͋ͨΓͷΈͰ ˏmodel Λ͚ͭͨ͘ͳ͍ͳΒɺ depth ઃఆؾʹͤͣɺ query
ίʔυΛ࡞͢Εྑ͍ https://dev.classmethod.jp/articles/amplify-tips-series-4/
Custom Resolver ͷ໋໊نଇΛ ઌʹܾΊΑ͏
Custom Resolver ͕ඞཁͷ߹ͬͯʁ • ECαΠτͷจAPIɿ - ܾࡁαʔϏεͱจαʔϏεͷ࿈ܞ - ใαʔϏεͱσϦόϦʔαʔϏε -
શͯΛ߹ΘͤͯτϥϯβΫγϣϯॲཧ • SNSͷྑ͍Ͷʂɿ - ୭͔ྑ͍Ͷʂ͔ͨ͠ʢϢʔβʔςʔϒϧʣ - ྑ͍Ͷʂͷτʔλϧ - ߘσʔλςʔϒϧ - શͯ߹ΘͤͯτϥϯβΫγϣϯॲཧ
schema.graphql
custom_resolver.yaml 1 2 3
custom_resolver.yaml
custom_resolver.yaml
custom_resolver.yaml
VTL ϑΝΠϧ Query.myCustomLambdaExecution.req.vtl
Custom Resolver ʹ͍ͭͯͷࢲͷߟ͑ • ϓϩδΣΫτͰඞཁͳ Custom Resolver ͕ݸఔͳΒແ͠ • ϓϩδΣΫτͰඞཁͳ
Custom Resolver ͕ेݸҎ্ͳΒɺ Custom Resolver ͷཧίετ։ൃίετ͕ߴ͘ͳΔ • ͬͱָʹ͢Δʹ Serverless Framework ͷ serverless-appsync- plugin Λར༻ͯ͠ AppSync Λߏங͢Δ → amplify codegen Ͱ͖Δ͠ɺcustom resolver ͷָ࣮ʹͳΔ → ͰɺAmplify ͷ σΟϨΫςΟϒ͑ͳ͍
ϒϩάಡΜͰΈ͍ͯͩ͘͞ :D
https://dev.classmethod.jp/tag/aws-amplify/
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ