fix(PolicyTemplate): DynamoDBStreamReadPolicy#1222
fix(PolicyTemplate): DynamoDBStreamReadPolicy#1222ShreyaGangishetty merged 2 commits intoaws:developfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1222 +/- ##
========================================
Coverage 94.43% 94.43%
========================================
Files 72 72
Lines 3736 3736
Branches 739 739
========================================
Hits 3528 3528
Misses 105 105
Partials 103 103Continue to review full report at Codecov.
|
|
It is a fix but it still feels a bit like a workaround. Do we maybe have a way to have this added to ddb: Desired: ddb already supports: Minor side note, Can thus be simplified to: |
keetonian
left a comment
There was a problem hiding this comment.
Looks good, just one change and it should be good to go!
| "Action": [ | ||
| "dynamodb:ListStreams" | ||
| ], | ||
| "Resource": "*" |
There was a problem hiding this comment.
Could we tighten the resources that this applies to? This way, they can list all the streams for the table that they specify in the policy template, or all streams if the user specifies a "*" for TableName.
"Resource": {
"Fn::Sub": [
"arn:${AWS::Partition}:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${tableName}/stream/*",
{
"tableName": {
"Ref": "TableName"
}
}
]
}
Issue #, if available: #289
Description of changes:
Please refer to #289 (comment)
Description of how you validated changes:
I deployed sam app like this:
ProcessDDBStreamFunction's Role got the policies as below:
{ "permissionsBoundary": {}, "roleName": "aiueo-ProcessDDBStreamFunctionRole-########", "policies": [ { "document": { "Statement": [ { "Action": [ "dynamodb:DescribeStream", "dynamodb:GetRecords", "dynamodb:GetShardIterator" ], "Resource": "arn:aws:dynamodb:ap-northeast-1:########:table/aiueo-DDBTable-########/stream/2019-10-26T15:18:10.410", "Effect": "Allow" }, { "Action": [ "dynamodb:ListStreams" ], "Resource": "*", "Effect": "Allow" } ] }, "name": "ProcessDDBStreamFunctionRolePolicy0", "type": "inline" }, { "document": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": "*" } ] }, "name": "AWSLambdaBasicExecutionRole", "id": "########", "type": "managed", "arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" } ], "trustedEntities": [ "lambda.amazonaws.com" ] }I associated the function with the ddb manually, then I created records into the ddb.
I verified that the function was triggered by ddb streams events successfully.
Checklist:
make prpassesUpdate documentationAdd/update example toexamples/2016-10-31By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.