Skip to content

Commit 49dab34

Browse files
authored
feat(dynamodb): global table L2 (#26563)
This PR is for the implementation of the `GlobalTable` L2. Please reference the following RFC: https://github.com/aws/aws-cdk-rfcs/blob/master/text/0510-dynamodb-global-table.md Closes #16118 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent b06a38f commit 49dab34

36 files changed

+41713
-538
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"version": "33.0.0",
3+
"files": {
4+
"7605c78d81246ac4a63b646e0f39ae3e697626ced7d652a031ea3f9dba4c613e": {
5+
"source": {
6+
"path": "asset.7605c78d81246ac4a63b646e0f39ae3e697626ced7d652a031ea3f9dba4c613e",
7+
"packaging": "zip"
8+
},
9+
"destinations": {
10+
"current_account-us-east-1": {
11+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1",
12+
"objectKey": "7605c78d81246ac4a63b646e0f39ae3e697626ced7d652a031ea3f9dba4c613e.zip",
13+
"region": "us-east-1",
14+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-us-east-1"
15+
}
16+
}
17+
},
18+
"ae0dd0d32332147cd7ad825eef90902d72051b1cb41575b1da051ae1432ceeb3": {
19+
"source": {
20+
"path": "BarStack.template.json",
21+
"packaging": "file"
22+
},
23+
"destinations": {
24+
"current_account-us-east-1": {
25+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1",
26+
"objectKey": "ae0dd0d32332147cd7ad825eef90902d72051b1cb41575b1da051ae1432ceeb3.json",
27+
"region": "us-east-1",
28+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-us-east-1"
29+
}
30+
}
31+
}
32+
},
33+
"dockerImages": {}
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
{
2+
"Resources": {
3+
"FunctionServiceRole675BB04A": {
4+
"Type": "AWS::IAM::Role",
5+
"Properties": {
6+
"AssumeRolePolicyDocument": {
7+
"Statement": [
8+
{
9+
"Action": "sts:AssumeRole",
10+
"Effect": "Allow",
11+
"Principal": {
12+
"Service": "lambda.amazonaws.com"
13+
}
14+
}
15+
],
16+
"Version": "2012-10-17"
17+
},
18+
"ManagedPolicyArns": [
19+
{
20+
"Fn::Join": [
21+
"",
22+
[
23+
"arn:",
24+
{
25+
"Ref": "AWS::Partition"
26+
},
27+
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
28+
]
29+
]
30+
}
31+
]
32+
}
33+
},
34+
"FunctionServiceRoleDefaultPolicy2F49994A": {
35+
"Type": "AWS::IAM::Policy",
36+
"Properties": {
37+
"PolicyDocument": {
38+
"Statement": [
39+
{
40+
"Action": [
41+
"dynamodb:BatchWriteItem",
42+
"dynamodb:DeleteItem",
43+
"dynamodb:DescribeTable",
44+
"dynamodb:PutItem",
45+
"dynamodb:UpdateItem"
46+
],
47+
"Effect": "Allow",
48+
"Resource": {
49+
"Fn::Join": [
50+
"",
51+
[
52+
"arn:aws:dynamodb:us-west-1:",
53+
{
54+
"Ref": "AWS::AccountId"
55+
},
56+
":table/",
57+
{
58+
"Ref": "Resource"
59+
}
60+
]
61+
]
62+
}
63+
}
64+
],
65+
"Version": "2012-10-17"
66+
},
67+
"PolicyName": "FunctionServiceRoleDefaultPolicy2F49994A",
68+
"Roles": [
69+
{
70+
"Ref": "FunctionServiceRole675BB04A"
71+
}
72+
]
73+
}
74+
},
75+
"Function76856677": {
76+
"Type": "AWS::Lambda::Function",
77+
"Properties": {
78+
"Code": {
79+
"S3Bucket": {
80+
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-us-east-1"
81+
},
82+
"S3Key": "7605c78d81246ac4a63b646e0f39ae3e697626ced7d652a031ea3f9dba4c613e.zip"
83+
},
84+
"FunctionName": "global-table-lambda",
85+
"Handler": "index.handler",
86+
"Role": {
87+
"Fn::GetAtt": [
88+
"FunctionServiceRole675BB04A",
89+
"Arn"
90+
]
91+
},
92+
"Runtime": "python3.11"
93+
},
94+
"DependsOn": [
95+
"FunctionServiceRoleDefaultPolicy2F49994A",
96+
"FunctionServiceRole675BB04A"
97+
]
98+
},
99+
"Resource": {
100+
"Type": "AWS::DynamoDB::GlobalTable",
101+
"Properties": {
102+
"AttributeDefinitions": [
103+
{
104+
"AttributeName": "pk",
105+
"AttributeType": "S"
106+
}
107+
],
108+
"BillingMode": "PAY_PER_REQUEST",
109+
"KeySchema": [
110+
{
111+
"AttributeName": "pk",
112+
"KeyType": "HASH"
113+
}
114+
],
115+
"Replicas": [
116+
{
117+
"Region": "us-west-1"
118+
},
119+
{
120+
"Region": "us-east-2"
121+
},
122+
{
123+
"Region": "us-east-1"
124+
}
125+
],
126+
"StreamSpecification": {
127+
"StreamViewType": "NEW_AND_OLD_IMAGES"
128+
},
129+
"TableName": "global-table"
130+
},
131+
"UpdateReplacePolicy": "Delete",
132+
"DeletionPolicy": "Delete"
133+
}
134+
},
135+
"Parameters": {
136+
"BootstrapVersion": {
137+
"Type": "AWS::SSM::Parameter::Value<String>",
138+
"Default": "/cdk-bootstrap/hnb659fds/version",
139+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
140+
}
141+
},
142+
"Rules": {
143+
"CheckBootstrapVersion": {
144+
"Assertions": [
145+
{
146+
"Assert": {
147+
"Fn::Not": [
148+
{
149+
"Fn::Contains": [
150+
[
151+
"1",
152+
"2",
153+
"3",
154+
"4",
155+
"5"
156+
],
157+
{
158+
"Ref": "BootstrapVersion"
159+
}
160+
]
161+
}
162+
]
163+
},
164+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
165+
}
166+
]
167+
}
168+
}
169+
}

0 commit comments

Comments
 (0)