From 2bce9533645e84f245523624294ea3f3d6191aaf Mon Sep 17 00:00:00 2001 From: Joel Van Horn <129096+joelvh@users.noreply.github.com> Date: Thu, 31 Aug 2023 17:20:38 -0400 Subject: [PATCH 1/4] Add DynamoDB table schema --- .../README.md | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/shopify-app-session-storage-dynamodb/README.md b/packages/shopify-app-session-storage-dynamodb/README.md index ddb9341ba3..572aae6651 100644 --- a/packages/shopify-app-session-storage-dynamodb/README.md +++ b/packages/shopify-app-session-storage-dynamodb/README.md @@ -23,4 +23,29 @@ const shopify = shopifyApp({ }); ``` +## Table Schema + +```js +{ + TableName: sessionTableName, + AttributeDefinitions: [ + {AttributeName: 'id', AttributeType: 'S'}, + {AttributeName: 'shop', AttributeType: 'S'}, + ], + KeySchema: [{AttributeName: 'id', KeyType: 'HASH'}], + GlobalSecondaryIndexes: [ + { + IndexName: shopIndexName, + KeySchema: [{AttributeName: 'shop', KeyType: 'HASH'}], + Projection: {ProjectionType: 'KEYS_ONLY'}, + ProvisionedThroughput: { + ReadCapacityUnits: 1, + WriteCapacityUnits: 1, + }, + }, + ], + ProvisionedThroughput: {ReadCapacityUnits: 1, WriteCapacityUnits: 1}, +} +``` + If you prefer to use your own implementation of a session storage mechanism that uses the `SessionStorage` interface, see the [implementing session storage guide](../shopify-app-session-storage/implementing-session-storage.md). From 2fed2cfc04c115cd4a3473332d788d9249f1ca29 Mon Sep 17 00:00:00 2001 From: Joel Van Horn <129096+joelvh@users.noreply.github.com> Date: Thu, 7 Sep 2023 05:35:37 -0400 Subject: [PATCH 2/4] Add policy example --- .../README.md | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/shopify-app-session-storage-dynamodb/README.md b/packages/shopify-app-session-storage-dynamodb/README.md index 572aae6651..ffa8676c9e 100644 --- a/packages/shopify-app-session-storage-dynamodb/README.md +++ b/packages/shopify-app-session-storage-dynamodb/README.md @@ -48,4 +48,30 @@ const shopify = shopifyApp({ } ``` +### AWS Policy for DynamoDB + +This policy must be attached to a user -- `dynamodb:Query` does not work with inline policies. + +```json +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "Statement1", + "Effect": "Allow", + "Action": [ + "dynamodb:GetItem", + "dynamodb:DeleteItem", + "dynamodb:PutItem", + "dynamodb:Query", + "dynamodb:DescribeTable" + ], + "Resource": [ + "arn:aws:dynamodb:::table/" + ] + } + ] +} +``` + If you prefer to use your own implementation of a session storage mechanism that uses the `SessionStorage` interface, see the [implementing session storage guide](../shopify-app-session-storage/implementing-session-storage.md). From e96a62c94780d59cc14c9e5305bfeb27326ee5d0 Mon Sep 17 00:00:00 2001 From: Joel Van Horn Date: Thu, 7 Dec 2023 15:18:48 -0500 Subject: [PATCH 3/4] add changeset --- .changeset/famous-eagles-tickle.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changeset/famous-eagles-tickle.md diff --git a/.changeset/famous-eagles-tickle.md b/.changeset/famous-eagles-tickle.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/famous-eagles-tickle.md @@ -0,0 +1,2 @@ +--- +--- From b861e3ad695453457c17194bb9b372a93a0eadf2 Mon Sep 17 00:00:00 2001 From: Joel Van Horn Date: Fri, 8 Dec 2023 17:35:24 -0500 Subject: [PATCH 4/4] Formatting fix --- .../README.md | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/packages/shopify-app-session-storage-dynamodb/README.md b/packages/shopify-app-session-storage-dynamodb/README.md index f6e426203d..be7b6c2735 100644 --- a/packages/shopify-app-session-storage-dynamodb/README.md +++ b/packages/shopify-app-session-storage-dynamodb/README.md @@ -54,23 +54,21 @@ This policy must be attached to a user -- `dynamodb:Query` does not work with in ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "Statement1", - "Effect": "Allow", - "Action": [ - "dynamodb:GetItem", - "dynamodb:DeleteItem", - "dynamodb:PutItem", - "dynamodb:Query", - "dynamodb:DescribeTable" - ], - "Resource": [ - "arn:aws:dynamodb:::table/" - ] - } - ] + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "Statement1", + "Effect": "Allow", + "Action": [ + "dynamodb:GetItem", + "dynamodb:DeleteItem", + "dynamodb:PutItem", + "dynamodb:Query", + "dynamodb:DescribeTable" + ], + "Resource": ["arn:aws:dynamodb:::table/"] + } + ] } ```