【旧版・説明欄参照ください】 サーバーレスアプリケーション向きの DB 設計ベストプラクティス

Amazon Web Services Japan
Amazon Web Services JapanAmazon Web Services Japan
B
2019.05.09
Amazon Web Services Japan K.K.
Akihiro Tsukada, Startup Solutions Architect, Manager
• # # #
• #
• #
# #
2
• D A
R
• A D
• B
3
9 B A 9 t D S p z O
• 9 B A 9 oml a
•
• 9 B A 9 e dg W O
k s n 9 B 0 1 ci[
• - 1 9 .
9 B A 9 2 1 2 p y
• A 9 ] h [| 9 1 1
• A 1 v PL A 9 rsb] 4
S LP D A B [ OL
W
]
5
【旧版・説明欄参照ください】 サーバーレスアプリケーション向きの DB 設計ベストプラクティス
AWS Lambda
7
AWS Lambda
Amazon RDSAmazon Aurora
Amazon DynamoDB
Amazon ElastiCache Amazon Neptune
...etc
8
., 9 b
AWS Lambda
., @ a D B R
L ., 5
01 2
Amazon
RDS
Amazon
Aurora
9
a S
AWS Lambda
Amazon
RDS
Amazon
Aurora
D L
b L M 1
1 B 1 d
B R B . .
…
!
10
Private subnet
. B a IbD i
L P DN V R S
E D 2 C I
. L P ICE . C
e Id I
AWS Lambda Amazon
Aurora
Amazon
RDS
VPC
✕
Any Subnet
Elastic network interface
11
Private subnet
.1 0. aBb
RN LI L B L P
L PV 2 B C
.1 0. D d
E
AWS Lambda Amazon
Aurora
Amazon
RDS
VPC
Any Subnet
Elastic network interface
12
【旧版・説明欄参照ください】 サーバーレスアプリケーション向きの DB 設計ベストプラクティス
DuoB
• n D V S m pt uy
• D ACPS
m g m Oz B D
• elc am -
e U id
Amazon
DynamoDBAWS Lambda
…
!
14
【旧版・説明欄参照ください】 サーバーレスアプリケーション向きの DB 設計ベストプラクティス
B u eK 1 t m a
• r P
• r
a a B K
S D
• o m
• r A Q P
• 1 P ) (
) 1 ( )( IP
)( + ( +( :
K D a
• + 1 IP )
• i a P
r c
r
• r a
I D
https://docs.aws.amazon.com/ja_jp/amazondynamodb/latest/developerguide/best-practices.html
ao aP
n y m B
16
B o R O
Q • S M O B
tf R Q R
• l e
• tfR Q R B i
n a
• pf o R Q a
L
• L D c
O
E
• R 17
B c
IET • B Ic
• o E t
B t
R
• Re
I t
• m I
• I ED
B aI
• B I
• y
I
• n I
• B
18
D B
19
B c
IET • B Ic
• o E t
B t
R
• Re
I t
• m I
• I ED
B aI
• B I
• y
I
• n I
• B
20
k E
(from re:Invent 2018 session)
•
c
• . 1
i E
• B e d
b R A a
• b d
21
B c
IET • B Ic
• o E t
B t
R
• Re
I t
• m I
• I ED
B aI
• B I
• y
I
• n I
• B
22
F IMKDP R E DI DI I
Use Case
C
C 2 A2 2
#
B
C
A2 2A A2 2A
A2 2A A2 2A
A2 2A 2 A2 2A A.
A2 2A 2 A2 2A
# 2A 2A C
2A 2 C
A2 A2
23
B c
IET • B Ic
• o E t
B t
R
• Re
I t
• m I
• I ED
B aI
• B I
• y
I
• n I
• B
24
.TABLE
Primary Key Attributes
PK SK, GSI-3-PK GSI-1-PK GSI-2-PK
Acr TargetACR AcrInfo1 AcrInfo2 EbookAsin
ABOOKACR1
ABOOKACR1-v0 ABOOK-ASIN1 ABOOK-SKU1
MAP-EBOOKACR1 SyncFileAcr ABOOK-ASIN1
ABOOKACR1#TRACK#1 ABOOK-ASIN1 ABOOK-SKU1
ABOOKACR1#TRACK#2 ABOOK-ASIN1 ABOOK-SKU1
EBOOKACR1 EBOOKACR1 EBOOK-SKU1 ASIN
25
.GSI1
GSI Partition Key Projected Attributes
GSI-1-PK Acr (Primary Table PK) TargetACR (Primary Table SK)
ABOOK-ASIN1 ABOOKACR1
ABOOKACR1-v1
ABOOKACR1#TRACK#1
ABOOKACR1#TRACK#2
SyncFileAcr ABOOKACR1 MAP-EBOOKACR1
EBOOK-SKU1 ABOOKACR1 EBOOKACR1
GSI2
GSI Partition Key Projected Attributes
GSI-2-PK Acr (Primary Table PK) TargetACR (Primary Table SK)
ABOOK-ASIN1 ABOOKACR1 MAP-EBOOKACR1
ABOOK-SKU1 ABOOKACR1
ABOOKACR1-v0
ABOOKACR1#TRACK#1
ABOOKACR1#TRACK#2
GSI3
GSI Partition Key Projected Attributes
TargetACR (Primary Table SK) Acr (Primary Table PK) TargetACR (Primary Table SK)
ABOOKACR1-v0 ABOOKACR1 ABOOKACR1-v0
MAP-EBOOKACR1 ABOOKACR1 MAP-EBOOKACR1
ABOOKACR1#TRACK#1 ABOOKACR1 ABOOKACR1#TRACK#1
ABOOKACR1#TRACK#2 ABOOKACR1 ABOOKACR1#TRACK#2
EBOOKACR1 EBOOKACR1 EBOOKACR1
26
B c
IET • B Ic
• o E t
B t
R
• Re
I t
• m I
• I ED
B aI
• B I
• y
I
• n I
• B
27
# Entity Use Case Lookup parameters Table / INDEX Key Conditions Filter Conditions
1 CompanionMapping getCompanionMappingsByAsin audiobookAsin/ebookSku GSI2 GSI-2=ABOOK-ASIN1 None
2 CompanionMapping
getCompanionMappingsByEbookAn
dAudiobookContentId
ebookAcr/sku,version,format or
audiobookAcr/asin,version,format
GSI-3 on TargetACR attribute OR
PrimaryKey on Table
GSI-3=MAP-EBOOKACR1 version=v and format=f
3 CompanionMapping getCompanionMappingsFromCache
ebookAcr/sku,version,format or
audiobookAcr/asin,version,format
GSI-3 on TargetACR attribute OR
PrimaryKey on Table
GSI-3=MAP-EBOOKACR1 version=v and format=f
4 CompanionMapping getCompanionMappings
syncfileAcr, ebookAcr?,
audiobookAcr?
GSI1 GSI-1=SyncFileAcr None
5 CompanionMapping getCompanionMappingsAvailable ebookAcr, audiobookAcr Primary Key on Table
Acr=ABOOKACR1 and
TargetACR beginswith "MAP-"
6 AcrInfo getACRInfo acr Primary Key on Table
Acr=ABOOKACR1 and
TargetACR beginswith
"ABOOKACR1-v"
7 AcrInfo getACRs acr / asin,version,format Primary Key on Table Acr=ABOOKACR1 version=v and format=f
8 AcrInfo getACRInfos acr Primary Key on table
Acr=ABOOKACR1 and
TargetACR beginswith "ABOOKACR1"
9 AcrInfo getACRInfosBySKU sku GSI2 GSI-2=ABOOK-SKU1
10 AudioProduct getAudioProductsForACRs acr Primary Key on table
Acr=ABOOKACR1 and TargetACR
beginswith "ABOOKACR1"
11 AudioProduct getAudioProducts sku, version, format GSI2 GSI-2=ABOOK-SKU1 version=v and format=f
12 AudioProduct
deleteAudioProductsMatchingSkuV
ersions
sku, version GSI2 GSI-2=ABOOK-SKU1 version=v
13 AudioProduct getChildAudioProductsForSKU sku GSI2 GSI-2=ABOOK-SKU1
14 Product getProductInfoByAsins asin GSI1 GSI-1=ABOOK-ASIN1
15 Product getParentChildDataByParentAsins asin GSI1 GSI-1=ABOOK-ASIN1
16 AudioFile getAudioFilesForACR acr Primary Key on table
Acr=ABOOKACR1 and
TargetACR beginswith
"ABOOKACR1#"
28
D e m a
IET • mD e m
• I
D E
R
• y a R m yB
m I
• ot I B
• R I
m D c I
• D I
• R I
m B n
• m I
• D I
29
B
D
30
B
B D
31
【旧版・説明欄参照ください】 サーバーレスアプリケーション向きの DB 設計ベストプラクティス
E
ID:
:
AWS Loft Tokyo:
:
:
ID
2 DynamoDB
AWS Loft
Tokyo
yy/3/4
#DynamoDB
#Serverless
14
AWS Loft
Tokyo
yy/5/9
#Serverless
#Lambda
#Design
33 API Night
AWS Loft
Tokyo
yy/6/23
#WebAPI #JWT
#APIGateway
#Auth #OAuth
#OIDC #Cognito
> >><< <
33
D e m a
IET • mD e m
• I
D E
R
• y a R m yB
m I
• ot I B
• R I
m D c I
• D I
• R I
m B n
• m I
• D I
34
id (PK)
name
venue_id (FK)
date
Events
id (PK)
name
Tags
event_id (PK, FK)
tag_id (PK, FK)
EventTags
id (PK)
name
address
Venues
-- SQL
-- :
SELECT e.id, v.name... FROM Events e
JOIN Venues v ON v.id = e.venue_id
JOIN EventTags et ON et.event_id = e.id
JOIN Tags t ON t.id = et.tag_id
WHERE v.name = :vname AND t.name = :tname
35
2 2 2
Use Case
. . . .
. . . .
. . .
. . . .
# . . .
. .
. .
36
【旧版・説明欄参照ください】 サーバーレスアプリケーション向きの DB 設計ベストプラクティス
i n t hc et Ql tTABLE
Partition Key Attributes
{EventID} {EventName} {VenueName} {TagName1, ...} {yyyy-mm-dd}
... ... ... ... ...
• . . . .3 GB I S
G D +- 3 . Q G
• +- 3 i n t hc m t
lma t Sr c
• QE +- 3 Q F D vQ D
u +- 3 QE . . . -/ . . S
D
BS y F
38
e b l cTABLE
Primary Key Attributes
Partition Key GSI-1-PK GSI-2-PK GSI-3-PK GSI-4-PK
{EventID} {EventName} {VenueName} {TagName1, ...} {yyyy-mm-dd}
... ... ... ... ...
• / + / . 0- 2 0-. 3.2
G
• S u b le b r a b b
• l o y x
b dn c Q I
39
-
GTABLE
Primary Key Attributes
PK, GSI-1-SK SK GSI-1-PK GSI-2-PK
ID DataType DataValue VenueName VenueAddress
{EventID} EventName {EventName}
{EventID} VenueID {VenueID}
{EventID} Date {yyyy-mm-dd}
{EventID} Tag_{TagName} Tag_{TagName}
{VenueID} VenueInfo {VenueName} {Address}
• S 3
• . I G
• 3 1
41
3 3GSI1
GSI Partition Key Projected Attributes
GSI-1-PK GSI-1-SK (Primary Table SK)
DataValue ID DataType VenueAddress
{EventName} {EventID} EventName
{VenueID} {EventID} Venue
{yyyy-mm-dd} {EventID} Date
Tag_{TagName} {EventID} Tag_{TagName}
GSI2
GSI Partition Key Projected Attributes
GSI-2-PK (Primary Table PK)
VenueName ID VenueAddress
{VenueName} {VenueID} {Address}
• . . 42
TABLE
Primary Key Attributes
PK, GSI-1-SK SK GSI-1-PK GSI-2-PK
ID DataType DataValue VenueName VenueAddress
E123 EventName DynamoDB
E123 VenueID V32
E123 Date yy/3/4
E123 Tag_#DynamoDB Tag_#DynamoDB
E123 Tag_#Serverless Tag_#Serverless
E145 EventName
E145 VenueID V32
E145 Date yy/5/9
E145 Tag_#Serverless Tag_#Serverless
E145 Tag_#Lambda Tag_#Lambda
E145 Tag_#Design Tag_#Design
V32 VenueInfo AWS Loft Tokyo
• . .4
• . 4 2 E
51 4 3
43
TABLE
Primary Key Attributes
PK, GSI-1-SK SK GSI-1-PK GSI-2-PK
ID DataType DataValue VenueName VenueAddress
E123 EventName DynamoDB
E123 VenueID V32
E123 Date yy/3/4
E123 Tag_#DynamoDB Tag_#DynamoDB
E123 Tag_#Serverless Tag_#Serverless
E145 EventName
E145 VenueID V32
E145 Date yy/5/9
E145 Tag_#Serverless Tag_#Serverless
E145 Tag_#Lambda Tag_#Lambda
E145 Tag_#Design Tag_#Design
V32 VenueInfo AWS Loft Tokyo
1 3
Query(ID = :eventId) . 3 : .
Table Query(ID = "E123") 44
TABLE
Primary Key Attributes
PK, GSI-1-SK SK GSI-1-PK GSI-2-PK
ID DataType DataValue VenueName VenueAddress
E123 EventName DynamoDB
E123 VenueID V32
E123 Date yy/3/4
E123 Tag_#DynamoDB Tag_#DynamoDB
E123 Tag_#Serverless Tag_#Serverless
E145 EventName
E145 VenueID V32
E145 Date yy/5/9
E145 Tag_#Serverless Tag_#Serverless
E145 Tag_#Lambda Tag_#Lambda
E145 Tag_#Design Tag_#Design
V32 VenueInfo AWS Loft Tokyo
1 3
Query(DataValue = :tagName) . : .
GSI1.Query(DataValue = "Tag_#Serverless") 45
dcj nlr
Use Case Parameters Table/Index API & Key Conditions
. DI I. DI . DI1- G C G B 4 G 1- ) ( DI1
. DI I. DI . DI2 C 1 4 G - I B ) ( DI2 C
. DI I. DI D 2 C
1
1
4 G D 2 C ) ( D 2 C
4 G - I B ) ( D 1
. DI I. DI - I 1 4 G - I B ) ( I
# . DI I. DI 1 4 G - I B ) (I 2 C
I . DI1- G C G B 4 G 1- ) ( DI1
D I D . DI1-
G C G B
G C G B
I1I C 1- ) ( DI1 D - I F ) D 1-
I1I C 1- ) ( D 1 D - I F ) D 1D=E
• i fe f B 1D bp N Sh gb
m aV TP I1I C I I:?1I C 4 G : D Qbus
• / BI G ,ED I ED GE :I ED . FG ED bot
46
【旧版・説明欄参照ください】 サーバーレスアプリケーション向きの DB 設計ベストプラクティス
A
• . . . a
. 1 B4
• y 2 D
•
n 3 .
. .
. o
o
• m z
o 3 48
s ztL P
• 9 B A 9 rpo [d
• A 9 h cg ]a
• 9 B A 9 h cg ]a
n 9 B 0 1 l
• - 1 9 .
9 B A 9 2 1 2 s
• A 9 bD ibkm 9 1 1
• A 1 y S OW A 9 v e Dm 49
【旧版・説明欄参照ください】 サーバーレスアプリケーション向きの DB 設計ベストプラクティス
【旧版・説明欄参照ください】 サーバーレスアプリケーション向きの DB 設計ベストプラクティス
D GI1 E A S D GI
TABLE
Primary Key Attributes
PK, GSI-1-SK SK GSI-1-PK
ID DataType DataValue1 DataValue2
{EventID} EventName {EventName}
{EventID} VenueInfo {VenueName} {Address}
{EventID} Date {yyyy-mm-dd}
{EventID} Tag_{TagName} Tag_{TagName}
•
. - D
52
-1 .TABLE
Primary Key Attributes
PK, GSI-1-SK SK GSI-1-PK
ID DataType DataValue1 DataValue2
E123 EventName DynamoDB
E123 VenueInfo AWS Loft Tokyo
E123 Date yy/3/4
E123 Tag_#DynamoDB Tag_#DynamoDB
E123 Tag_#Serverless Tag_#Serverless
E145 EventName
E145 VenueID AWS Loft Tokyo
E145 Date yy/5/9
E145 Tag_#Serverless Tag_#Serverless
E145 Tag_#Lambda Tag_#Lambda
E145 Tag_#Design Tag_#Design
53
1 -. 1 -.GSI1
GSI Partition Key Projected Attributes
GSI-1-PK GSI-1-SK (Primary Table SK)
DataValue ID DataValue1 DataValue2
{EventName} {EventID} EventName
{VenueID} {EventID} Venue
{yyyy-mm-dd} {EventID} Date
Tag_{TagName} {EventID} Tag_{TagName}
{VenueName} {EventID} {VenueName} {Address}
54
(BB =I _iurmv
Use Case Parameters Table/Index API & Key Conditions
G ED E G E) G E. C= C 1 C . G E.
G ED E G ED) G E/ - . 1 C E G E/
G ED E G ED) / - . 1 C E G /
G ED E G ED) E - . 1 C E E
# G ED E G ED) - . 1 C E E /
D E D) G E. C= C
1 C
. G E. E B = D =E
E ) G E. C= C
- E.E
. G E E B . :A
• T o w h a i e nr V
• tl fd y xP CAD A D y Q NpS sg b 55
2 U m E SVg I d
1 -
1 - .
d nm
A- . B
d , .
e
x um
• V I E EU G E U
• G 2 d I
a S a m d
• i s
• A my t e VB
• ir v p NS S G E
56
【旧版・説明欄参照ください】 サーバーレスアプリケーション向きの DB 設計ベストプラクティス
- 2.
TABLE
Primary Key Attributes
PK SK, GSI-1-PK GSI-1-SK
EventID DataType DataValue
{EventID} EventName {EventName}
{EventID} VenueName {VenueName}
{EventID} VenueAddress {VenueAddress}
{EventID} Date {yyyy-mm-dd}
{EventID} Tag_{n} {TagName}
58
2 - .
TABLE
Primary Key Attributes
PK SK, GSI-1-PK GSI-1-SK
EventID DataType DataValue
E123 EventName DynamoDB
E123 VenueName AWS Loft Tokyo
E123 VenueAddress
E123 Date yy/3/4
E123 Tag_1 #DynamoDB
E123 Tag_2 #Serverless
E145 EventName
E145 VenueName AWS Loft Tokyo
E145 VenueAddress
E145 Date yy/5/9
E145 Tag_1 #Serverless
E145 Tag_2 #Lambda
E145 Tag_3 #Design
59
2 . -GSI1
GSI Partition Key Projected Attributes
GSI-1-PK GSI-1-SK (Primary Table SK)
DataType DataValue EventID
EventName {EventName} {EventID}
VenueName {VenueName} {EventID}
VenueAddress {VenueAddress} {EventID}
Date {yyyy-mm-dd} {EventID}
Tag_{n} {TagName} {EventID}
60
:: TS
Use Case Parameters Table/Index Key Conditions
= = = A = - 1 A 12 = =
= = = A = 1 .
1=1 A: = 1
= 1 = 1
= = = A 1 .
1=1 A: 1
1 1
# = = = A 1= .
1=1 A: 1=
1= 1=
= = = A 1
4825
6
57 3 1
1 = 1 A 1 1
1 = 1 A =
= A =
• P = = A 1 I N P BDaG V E
61
. - N . . N PB
GSI1
GSI Partition Key Projected Attributes
GSI-1-PK GSI-1-SK (Primary Table SK)
DataType DataValue EventID
EventName {EventName} {EventID}
VenueName {VenueName} {EventID}
VenueAddress {VenueAddress} {EventID}
Date {yyyy-mm-dd} {EventID}
Tag_{n} {TagName} {EventID}
• 2. BS . b KT
Query(DataType = begins_with("Tag_") and DataValue = :tagName)
. _ . B AN
• Query(DataType = Tag_{n} and DataValue = :tagName)
dBS Pe TE
. a N
62
1 of 62

Recommended

202205 AWS Black Belt Online Seminar Amazon VPC IP Address Manager (IPAM) by
202205 AWS Black Belt Online Seminar Amazon VPC IP Address Manager (IPAM)202205 AWS Black Belt Online Seminar Amazon VPC IP Address Manager (IPAM)
202205 AWS Black Belt Online Seminar Amazon VPC IP Address Manager (IPAM)Amazon Web Services Japan
7K views62 slides
Infrastructure as Code (IaC) 談義 2022 by
Infrastructure as Code (IaC) 談義 2022Infrastructure as Code (IaC) 談義 2022
Infrastructure as Code (IaC) 談義 2022Amazon Web Services Japan
3.3K views21 slides
Amazon Game Tech Night #25 ゲーム業界向け機械学習最新状況アップデート by
Amazon Game Tech Night #25 ゲーム業界向け機械学習最新状況アップデートAmazon Game Tech Night #25 ゲーム業界向け機械学習最新状況アップデート
Amazon Game Tech Night #25 ゲーム業界向け機械学習最新状況アップデートAmazon Web Services Japan
2K views52 slides
20220409 AWS BLEA 開発にあたって検討したこと by
20220409 AWS BLEA 開発にあたって検討したこと20220409 AWS BLEA 開発にあたって検討したこと
20220409 AWS BLEA 開発にあたって検討したことAmazon Web Services Japan
3.7K views28 slides
SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介 by
SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介
SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介Amazon Web Services Japan
4.1K views36 slides
マルチテナント化で知っておきたいデータベースのこと by
マルチテナント化で知っておきたいデータベースのことマルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのことAmazon Web Services Japan
9K views55 slides

More Related Content

More from Amazon Web Services Japan

202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ... by
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...Amazon Web Services Japan
4.4K views108 slides
20211209 Ops-JAWS Re invent2021re-cap-cloud operations by
20211209 Ops-JAWS Re invent2021re-cap-cloud operations20211209 Ops-JAWS Re invent2021re-cap-cloud operations
20211209 Ops-JAWS Re invent2021re-cap-cloud operationsAmazon Web Services Japan
3.5K views48 slides
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報 by
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報Amazon Web Services Japan
15.2K views173 slides
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな by
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをなAmazon Web Services Japan
5.6K views64 slides
20211109 JAWS-UG SRE keynotes by
20211109 JAWS-UG SRE keynotes20211109 JAWS-UG SRE keynotes
20211109 JAWS-UG SRE keynotesAmazon Web Services Japan
2K views37 slides
20211109 bleaの使い方(基本編) by
20211109 bleaの使い方(基本編)20211109 bleaの使い方(基本編)
20211109 bleaの使い方(基本編)Amazon Web Services Japan
2.2K views26 slides

More from Amazon Web Services Japan(20)

202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ... by Amazon Web Services Japan
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報 by Amazon Web Services Japan
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな by Amazon Web Services Japan
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
AWS IoT Coreを オンプレミス環境と使う際の アーキテクチャ例 (AWS IoT Deep Dive #5) by Amazon Web Services Japan
AWS IoT Coreを オンプレミス環境と使う際の アーキテクチャ例 (AWS IoT Deep Dive #5)AWS IoT Coreを オンプレミス環境と使う際の アーキテクチャ例 (AWS IoT Deep Dive #5)
AWS IoT Coreを オンプレミス環境と使う際の アーキテクチャ例 (AWS IoT Deep Dive #5)
IoT@Loft#20 - IoTプラットフォームを進化さ せるAWSの活用方法 by Amazon Web Services Japan
IoT@Loft#20 - IoTプラットフォームを進化さ せるAWSの活用方法IoT@Loft#20 - IoTプラットフォームを進化さ せるAWSの活用方法
IoT@Loft#20 - IoTプラットフォームを進化さ せるAWSの活用方法
202106 AWS Black Belt Online Seminar 小売現場のデータを素早くビジネス に活用するAWSデータ基盤 by Amazon Web Services Japan
202106 AWS Black Belt Online Seminar 小売現場のデータを素早くビジネス に活用するAWSデータ基盤202106 AWS Black Belt Online Seminar 小売現場のデータを素早くビジネス に活用するAWSデータ基盤
202106 AWS Black Belt Online Seminar 小売現場のデータを素早くビジネス に活用するAWSデータ基盤
Kinesis + Elasticsearchでつくるさいきょうのログ分析基盤 by Amazon Web Services Japan
Kinesis + Elasticsearchでつくるさいきょうのログ分析基盤Kinesis + Elasticsearchでつくるさいきょうのログ分析基盤
Kinesis + Elasticsearchでつくるさいきょうのログ分析基盤
Tealium+AWS Analytics サービスで実現する Customer Experience(CX) by Amazon Web Services Japan
Tealium+AWS Analytics サービスで実現する Customer Experience(CX)Tealium+AWS Analytics サービスで実現する Customer Experience(CX)
Tealium+AWS Analytics サービスで実現する Customer Experience(CX)

Recently uploaded

Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...ShapeBlue
77 views12 slides
DRBD Deep Dive - Philipp Reisner - LINBIT by
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBITShapeBlue
62 views21 slides
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...ShapeBlue
88 views20 slides
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueShapeBlue
96 views7 slides
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITShapeBlue
91 views8 slides
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOsPriyanka Aash
81 views59 slides

Recently uploaded(20)

Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by ShapeBlue
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
ShapeBlue77 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue62 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue88 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue96 views
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue91 views
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash81 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue50 views
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue34 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu141 views
State of the Union - Rohit Yadav - Apache CloudStack by ShapeBlue
State of the Union - Rohit Yadav - Apache CloudStackState of the Union - Rohit Yadav - Apache CloudStack
State of the Union - Rohit Yadav - Apache CloudStack
ShapeBlue145 views
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada
Fwdays40 views
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue111 views
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool by ShapeBlue
Extending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPoolExtending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPool
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool
ShapeBlue40 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc77 views
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue83 views
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue57 views
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue74 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue85 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue96 views

【旧版・説明欄参照ください】 サーバーレスアプリケーション向きの DB 設計ベストプラクティス

  • 1. B 2019.05.09 Amazon Web Services Japan K.K. Akihiro Tsukada, Startup Solutions Architect, Manager
  • 2. • # # # • # • # # # 2
  • 3. • D A R • A D • B 3
  • 4. 9 B A 9 t D S p z O • 9 B A 9 oml a • • 9 B A 9 e dg W O k s n 9 B 0 1 ci[ • - 1 9 . 9 B A 9 2 1 2 p y • A 9 ] h [| 9 1 1 • A 1 v PL A 9 rsb] 4
  • 5. S LP D A B [ OL W ] 5
  • 8. AWS Lambda Amazon RDSAmazon Aurora Amazon DynamoDB Amazon ElastiCache Amazon Neptune ...etc 8
  • 9. ., 9 b AWS Lambda ., @ a D B R L ., 5 01 2 Amazon RDS Amazon Aurora 9
  • 10. a S AWS Lambda Amazon RDS Amazon Aurora D L b L M 1 1 B 1 d B R B . . … ! 10
  • 11. Private subnet . B a IbD i L P DN V R S E D 2 C I . L P ICE . C e Id I AWS Lambda Amazon Aurora Amazon RDS VPC ✕ Any Subnet Elastic network interface 11
  • 12. Private subnet .1 0. aBb RN LI L B L P L PV 2 B C .1 0. D d E AWS Lambda Amazon Aurora Amazon RDS VPC Any Subnet Elastic network interface 12
  • 14. DuoB • n D V S m pt uy • D ACPS m g m Oz B D • elc am - e U id Amazon DynamoDBAWS Lambda … ! 14
  • 16. B u eK 1 t m a • r P • r a a B K S D • o m • r A Q P • 1 P ) ( ) 1 ( )( IP )( + ( +( : K D a • + 1 IP ) • i a P r c r • r a I D https://docs.aws.amazon.com/ja_jp/amazondynamodb/latest/developerguide/best-practices.html ao aP n y m B 16
  • 17. B o R O Q • S M O B tf R Q R • l e • tfR Q R B i n a • pf o R Q a L • L D c O E • R 17
  • 18. B c IET • B Ic • o E t B t R • Re I t • m I • I ED B aI • B I • y I • n I • B 18
  • 20. B c IET • B Ic • o E t B t R • Re I t • m I • I ED B aI • B I • y I • n I • B 20
  • 21. k E (from re:Invent 2018 session) • c • . 1 i E • B e d b R A a • b d 21
  • 22. B c IET • B Ic • o E t B t R • Re I t • m I • I ED B aI • B I • y I • n I • B 22
  • 23. F IMKDP R E DI DI I Use Case C C 2 A2 2 # B C A2 2A A2 2A A2 2A A2 2A A2 2A 2 A2 2A A. A2 2A 2 A2 2A # 2A 2A C 2A 2 C A2 A2 23
  • 24. B c IET • B Ic • o E t B t R • Re I t • m I • I ED B aI • B I • y I • n I • B 24
  • 25. .TABLE Primary Key Attributes PK SK, GSI-3-PK GSI-1-PK GSI-2-PK Acr TargetACR AcrInfo1 AcrInfo2 EbookAsin ABOOKACR1 ABOOKACR1-v0 ABOOK-ASIN1 ABOOK-SKU1 MAP-EBOOKACR1 SyncFileAcr ABOOK-ASIN1 ABOOKACR1#TRACK#1 ABOOK-ASIN1 ABOOK-SKU1 ABOOKACR1#TRACK#2 ABOOK-ASIN1 ABOOK-SKU1 EBOOKACR1 EBOOKACR1 EBOOK-SKU1 ASIN 25
  • 26. .GSI1 GSI Partition Key Projected Attributes GSI-1-PK Acr (Primary Table PK) TargetACR (Primary Table SK) ABOOK-ASIN1 ABOOKACR1 ABOOKACR1-v1 ABOOKACR1#TRACK#1 ABOOKACR1#TRACK#2 SyncFileAcr ABOOKACR1 MAP-EBOOKACR1 EBOOK-SKU1 ABOOKACR1 EBOOKACR1 GSI2 GSI Partition Key Projected Attributes GSI-2-PK Acr (Primary Table PK) TargetACR (Primary Table SK) ABOOK-ASIN1 ABOOKACR1 MAP-EBOOKACR1 ABOOK-SKU1 ABOOKACR1 ABOOKACR1-v0 ABOOKACR1#TRACK#1 ABOOKACR1#TRACK#2 GSI3 GSI Partition Key Projected Attributes TargetACR (Primary Table SK) Acr (Primary Table PK) TargetACR (Primary Table SK) ABOOKACR1-v0 ABOOKACR1 ABOOKACR1-v0 MAP-EBOOKACR1 ABOOKACR1 MAP-EBOOKACR1 ABOOKACR1#TRACK#1 ABOOKACR1 ABOOKACR1#TRACK#1 ABOOKACR1#TRACK#2 ABOOKACR1 ABOOKACR1#TRACK#2 EBOOKACR1 EBOOKACR1 EBOOKACR1 26
  • 27. B c IET • B Ic • o E t B t R • Re I t • m I • I ED B aI • B I • y I • n I • B 27
  • 28. # Entity Use Case Lookup parameters Table / INDEX Key Conditions Filter Conditions 1 CompanionMapping getCompanionMappingsByAsin audiobookAsin/ebookSku GSI2 GSI-2=ABOOK-ASIN1 None 2 CompanionMapping getCompanionMappingsByEbookAn dAudiobookContentId ebookAcr/sku,version,format or audiobookAcr/asin,version,format GSI-3 on TargetACR attribute OR PrimaryKey on Table GSI-3=MAP-EBOOKACR1 version=v and format=f 3 CompanionMapping getCompanionMappingsFromCache ebookAcr/sku,version,format or audiobookAcr/asin,version,format GSI-3 on TargetACR attribute OR PrimaryKey on Table GSI-3=MAP-EBOOKACR1 version=v and format=f 4 CompanionMapping getCompanionMappings syncfileAcr, ebookAcr?, audiobookAcr? GSI1 GSI-1=SyncFileAcr None 5 CompanionMapping getCompanionMappingsAvailable ebookAcr, audiobookAcr Primary Key on Table Acr=ABOOKACR1 and TargetACR beginswith "MAP-" 6 AcrInfo getACRInfo acr Primary Key on Table Acr=ABOOKACR1 and TargetACR beginswith "ABOOKACR1-v" 7 AcrInfo getACRs acr / asin,version,format Primary Key on Table Acr=ABOOKACR1 version=v and format=f 8 AcrInfo getACRInfos acr Primary Key on table Acr=ABOOKACR1 and TargetACR beginswith "ABOOKACR1" 9 AcrInfo getACRInfosBySKU sku GSI2 GSI-2=ABOOK-SKU1 10 AudioProduct getAudioProductsForACRs acr Primary Key on table Acr=ABOOKACR1 and TargetACR beginswith "ABOOKACR1" 11 AudioProduct getAudioProducts sku, version, format GSI2 GSI-2=ABOOK-SKU1 version=v and format=f 12 AudioProduct deleteAudioProductsMatchingSkuV ersions sku, version GSI2 GSI-2=ABOOK-SKU1 version=v 13 AudioProduct getChildAudioProductsForSKU sku GSI2 GSI-2=ABOOK-SKU1 14 Product getProductInfoByAsins asin GSI1 GSI-1=ABOOK-ASIN1 15 Product getParentChildDataByParentAsins asin GSI1 GSI-1=ABOOK-ASIN1 16 AudioFile getAudioFilesForACR acr Primary Key on table Acr=ABOOKACR1 and TargetACR beginswith "ABOOKACR1#" 28
  • 29. D e m a IET • mD e m • I D E R • y a R m yB m I • ot I B • R I m D c I • D I • R I m B n • m I • D I 29
  • 33. E ID: : AWS Loft Tokyo: : : ID 2 DynamoDB AWS Loft Tokyo yy/3/4 #DynamoDB #Serverless 14 AWS Loft Tokyo yy/5/9 #Serverless #Lambda #Design 33 API Night AWS Loft Tokyo yy/6/23 #WebAPI #JWT #APIGateway #Auth #OAuth #OIDC #Cognito > >><< < 33
  • 34. D e m a IET • mD e m • I D E R • y a R m yB m I • ot I B • R I m D c I • D I • R I m B n • m I • D I 34
  • 35. id (PK) name venue_id (FK) date Events id (PK) name Tags event_id (PK, FK) tag_id (PK, FK) EventTags id (PK) name address Venues -- SQL -- : SELECT e.id, v.name... FROM Events e JOIN Venues v ON v.id = e.venue_id JOIN EventTags et ON et.event_id = e.id JOIN Tags t ON t.id = et.tag_id WHERE v.name = :vname AND t.name = :tname 35
  • 36. 2 2 2 Use Case . . . . . . . . . . . . . . . # . . . . . . . 36
  • 38. i n t hc et Ql tTABLE Partition Key Attributes {EventID} {EventName} {VenueName} {TagName1, ...} {yyyy-mm-dd} ... ... ... ... ... • . . . .3 GB I S G D +- 3 . Q G • +- 3 i n t hc m t lma t Sr c • QE +- 3 Q F D vQ D u +- 3 QE . . . -/ . . S D BS y F 38
  • 39. e b l cTABLE Primary Key Attributes Partition Key GSI-1-PK GSI-2-PK GSI-3-PK GSI-4-PK {EventID} {EventName} {VenueName} {TagName1, ...} {yyyy-mm-dd} ... ... ... ... ... • / + / . 0- 2 0-. 3.2 G • S u b le b r a b b • l o y x b dn c Q I 39
  • 40. -
  • 41. GTABLE Primary Key Attributes PK, GSI-1-SK SK GSI-1-PK GSI-2-PK ID DataType DataValue VenueName VenueAddress {EventID} EventName {EventName} {EventID} VenueID {VenueID} {EventID} Date {yyyy-mm-dd} {EventID} Tag_{TagName} Tag_{TagName} {VenueID} VenueInfo {VenueName} {Address} • S 3 • . I G • 3 1 41
  • 42. 3 3GSI1 GSI Partition Key Projected Attributes GSI-1-PK GSI-1-SK (Primary Table SK) DataValue ID DataType VenueAddress {EventName} {EventID} EventName {VenueID} {EventID} Venue {yyyy-mm-dd} {EventID} Date Tag_{TagName} {EventID} Tag_{TagName} GSI2 GSI Partition Key Projected Attributes GSI-2-PK (Primary Table PK) VenueName ID VenueAddress {VenueName} {VenueID} {Address} • . . 42
  • 43. TABLE Primary Key Attributes PK, GSI-1-SK SK GSI-1-PK GSI-2-PK ID DataType DataValue VenueName VenueAddress E123 EventName DynamoDB E123 VenueID V32 E123 Date yy/3/4 E123 Tag_#DynamoDB Tag_#DynamoDB E123 Tag_#Serverless Tag_#Serverless E145 EventName E145 VenueID V32 E145 Date yy/5/9 E145 Tag_#Serverless Tag_#Serverless E145 Tag_#Lambda Tag_#Lambda E145 Tag_#Design Tag_#Design V32 VenueInfo AWS Loft Tokyo • . .4 • . 4 2 E 51 4 3 43
  • 44. TABLE Primary Key Attributes PK, GSI-1-SK SK GSI-1-PK GSI-2-PK ID DataType DataValue VenueName VenueAddress E123 EventName DynamoDB E123 VenueID V32 E123 Date yy/3/4 E123 Tag_#DynamoDB Tag_#DynamoDB E123 Tag_#Serverless Tag_#Serverless E145 EventName E145 VenueID V32 E145 Date yy/5/9 E145 Tag_#Serverless Tag_#Serverless E145 Tag_#Lambda Tag_#Lambda E145 Tag_#Design Tag_#Design V32 VenueInfo AWS Loft Tokyo 1 3 Query(ID = :eventId) . 3 : . Table Query(ID = "E123") 44
  • 45. TABLE Primary Key Attributes PK, GSI-1-SK SK GSI-1-PK GSI-2-PK ID DataType DataValue VenueName VenueAddress E123 EventName DynamoDB E123 VenueID V32 E123 Date yy/3/4 E123 Tag_#DynamoDB Tag_#DynamoDB E123 Tag_#Serverless Tag_#Serverless E145 EventName E145 VenueID V32 E145 Date yy/5/9 E145 Tag_#Serverless Tag_#Serverless E145 Tag_#Lambda Tag_#Lambda E145 Tag_#Design Tag_#Design V32 VenueInfo AWS Loft Tokyo 1 3 Query(DataValue = :tagName) . : . GSI1.Query(DataValue = "Tag_#Serverless") 45
  • 46. dcj nlr Use Case Parameters Table/Index API & Key Conditions . DI I. DI . DI1- G C G B 4 G 1- ) ( DI1 . DI I. DI . DI2 C 1 4 G - I B ) ( DI2 C . DI I. DI D 2 C 1 1 4 G D 2 C ) ( D 2 C 4 G - I B ) ( D 1 . DI I. DI - I 1 4 G - I B ) ( I # . DI I. DI 1 4 G - I B ) (I 2 C I . DI1- G C G B 4 G 1- ) ( DI1 D I D . DI1- G C G B G C G B I1I C 1- ) ( DI1 D - I F ) D 1- I1I C 1- ) ( D 1 D - I F ) D 1D=E • i fe f B 1D bp N Sh gb m aV TP I1I C I I:?1I C 4 G : D Qbus • / BI G ,ED I ED GE :I ED . FG ED bot 46
  • 48. A • . . . a . 1 B4 • y 2 D • n 3 . . . . o o • m z o 3 48
  • 49. s ztL P • 9 B A 9 rpo [d • A 9 h cg ]a • 9 B A 9 h cg ]a n 9 B 0 1 l • - 1 9 . 9 B A 9 2 1 2 s • A 9 bD ibkm 9 1 1 • A 1 y S OW A 9 v e Dm 49
  • 52. D GI1 E A S D GI TABLE Primary Key Attributes PK, GSI-1-SK SK GSI-1-PK ID DataType DataValue1 DataValue2 {EventID} EventName {EventName} {EventID} VenueInfo {VenueName} {Address} {EventID} Date {yyyy-mm-dd} {EventID} Tag_{TagName} Tag_{TagName} • . - D 52
  • 53. -1 .TABLE Primary Key Attributes PK, GSI-1-SK SK GSI-1-PK ID DataType DataValue1 DataValue2 E123 EventName DynamoDB E123 VenueInfo AWS Loft Tokyo E123 Date yy/3/4 E123 Tag_#DynamoDB Tag_#DynamoDB E123 Tag_#Serverless Tag_#Serverless E145 EventName E145 VenueID AWS Loft Tokyo E145 Date yy/5/9 E145 Tag_#Serverless Tag_#Serverless E145 Tag_#Lambda Tag_#Lambda E145 Tag_#Design Tag_#Design 53
  • 54. 1 -. 1 -.GSI1 GSI Partition Key Projected Attributes GSI-1-PK GSI-1-SK (Primary Table SK) DataValue ID DataValue1 DataValue2 {EventName} {EventID} EventName {VenueID} {EventID} Venue {yyyy-mm-dd} {EventID} Date Tag_{TagName} {EventID} Tag_{TagName} {VenueName} {EventID} {VenueName} {Address} 54
  • 55. (BB =I _iurmv Use Case Parameters Table/Index API & Key Conditions G ED E G E) G E. C= C 1 C . G E. G ED E G ED) G E/ - . 1 C E G E/ G ED E G ED) / - . 1 C E G / G ED E G ED) E - . 1 C E E # G ED E G ED) - . 1 C E E / D E D) G E. C= C 1 C . G E. E B = D =E E ) G E. C= C - E.E . G E E B . :A • T o w h a i e nr V • tl fd y xP CAD A D y Q NpS sg b 55
  • 56. 2 U m E SVg I d 1 - 1 - . d nm A- . B d , . e x um • V I E EU G E U • G 2 d I a S a m d • i s • A my t e VB • ir v p NS S G E 56
  • 58. - 2. TABLE Primary Key Attributes PK SK, GSI-1-PK GSI-1-SK EventID DataType DataValue {EventID} EventName {EventName} {EventID} VenueName {VenueName} {EventID} VenueAddress {VenueAddress} {EventID} Date {yyyy-mm-dd} {EventID} Tag_{n} {TagName} 58
  • 59. 2 - . TABLE Primary Key Attributes PK SK, GSI-1-PK GSI-1-SK EventID DataType DataValue E123 EventName DynamoDB E123 VenueName AWS Loft Tokyo E123 VenueAddress E123 Date yy/3/4 E123 Tag_1 #DynamoDB E123 Tag_2 #Serverless E145 EventName E145 VenueName AWS Loft Tokyo E145 VenueAddress E145 Date yy/5/9 E145 Tag_1 #Serverless E145 Tag_2 #Lambda E145 Tag_3 #Design 59
  • 60. 2 . -GSI1 GSI Partition Key Projected Attributes GSI-1-PK GSI-1-SK (Primary Table SK) DataType DataValue EventID EventName {EventName} {EventID} VenueName {VenueName} {EventID} VenueAddress {VenueAddress} {EventID} Date {yyyy-mm-dd} {EventID} Tag_{n} {TagName} {EventID} 60
  • 61. :: TS Use Case Parameters Table/Index Key Conditions = = = A = - 1 A 12 = = = = = A = 1 . 1=1 A: = 1 = 1 = 1 = = = A 1 . 1=1 A: 1 1 1 # = = = A 1= . 1=1 A: 1= 1= 1= = = = A 1 4825 6 57 3 1 1 = 1 A 1 1 1 = 1 A = = A = • P = = A 1 I N P BDaG V E 61
  • 62. . - N . . N PB GSI1 GSI Partition Key Projected Attributes GSI-1-PK GSI-1-SK (Primary Table SK) DataType DataValue EventID EventName {EventName} {EventID} VenueName {VenueName} {EventID} VenueAddress {VenueAddress} {EventID} Date {yyyy-mm-dd} {EventID} Tag_{n} {TagName} {EventID} • 2. BS . b KT Query(DataType = begins_with("Tag_") and DataValue = :tagName) . _ . B AN • Query(DataType = Tag_{n} and DataValue = :tagName) dBS Pe TE . a N 62