Skip to content

Commit 6ed3232

Browse files
committed
GuKCLPolicy: Fix DynamoDB permissions on new KCL v3 tables
In PR #2578 I failed to give the `UpdateItem` & `DeleteItem` permissions on these new KCL v3 tables: * worker metrics: https://docs.aws.amazon.com/streams/latest/dev/kcl-dynamoDB.html#kcl-worker-metrics-table * coordinator state: https://docs.aws.amazon.com/streams/latest/dev/kcl-dynamoDB.html#kcl-coordinator-state-table ...the permissions were correctly granted on the 'lease' table, so existing code, based on KCL v2, _worked_ (as seen in guardian/apple-news#426 (comment)), but as soon as the code was updated to KCL v3, errors were seen: guardian/apple-news#398 (comment) This fix correctly grants the `UpdateItem` & `DeleteItem` permissions to all 3 tables. For reference, the full list of permissions are at: https://docs.aws.amazon.com/streams/latest/dev/kcl-iam-permissions.html
1 parent 5cdc86f commit 6ed3232

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.changeset/cold-rivers-laugh.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@guardian/cdk": patch
3+
---
4+
5+
GuKCLPolicy: Fix DynamoDB permissions on new KCL v3 tables

src/constructs/iam/policies/kcl.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ describe("GuKCLPolicy", () => {
5555
"dynamodb:DescribeTable",
5656
"dynamodb:GetItem",
5757
"dynamodb:PutItem",
58+
"dynamodb:UpdateItem",
59+
"dynamodb:DeleteItem",
5860
],
5961
Effect: "Allow",
6062
Resource: [
@@ -91,7 +93,7 @@ describe("GuKCLPolicy", () => {
9193
],
9294
},
9395
{
94-
Action: ["dynamodb:UpdateTable", "dynamodb:UpdateItem", "dynamodb:DeleteItem"],
96+
Action: "dynamodb:UpdateTable",
9597
Effect: "Allow",
9698
Resource: {
9799
"Fn::Join": [

src/constructs/iam/policies/kcl.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ const actionsOnAllTables: string[] = [
2424
"DescribeTable",
2525
"GetItem",
2626
"PutItem",
27+
"UpdateItem",
28+
"DeleteItem",
2729
];
2830

29-
const additionalLeaseTableActions: string[] = ["UpdateTable", "UpdateItem", "DeleteItem"];
31+
const additionalLeaseTableActions: string[] = ["UpdateTable"];
3032

3133
/**
3234
* Creates an `AWS::IAM::Policy` to grant all the required permissions for the Kinesis Client Library

0 commit comments

Comments
 (0)