Skip to content

Commit

Permalink
Add authorizer db role.
Browse files Browse the repository at this point in the history
  • Loading branch information
marklise committed Oct 8, 2024
1 parent 15df893 commit d792e3d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,39 @@ Resources:
DependsOn: DynamoDBTable

## Roles
ReadDynamoDBRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- 'sts:AssumeRole'
ManagedPolicyArns:
- 'arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
- 'arn:aws:iam::aws:policy/service-role/AWSLambdaDynamoDBExecutionRole'
- 'arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole'
Policies:
- PolicyName: 'ProcessDynamoDBStreamRolePolicyOne'
PolicyDocument:
Version: '2012-10-17'
Statement:
-
Action:
- dynamodb:GetItem
- dynamodb:Scan
- dynamodb:Query
- dynamodb:DescribeTable
- dynamodb:ConditionCheckItem
Resource: !Sub
- 'arn:aws:dynamodb:ca-central-1:${AccountId}:table/reserve-rec'
- AccountId: !Ref AccountId
Effect: Allow

StreamRole:
Type: AWS::IAM::Role
Properties:
Expand Down Expand Up @@ -358,6 +391,7 @@ Resources:
- !Ref BaseLayer
- !Ref AWSUtilsLayer
Runtime: nodejs18.x
Role: !GetAtt ReadDynamoDBRole.Arn
Environment:
Variables:
LOG_LEVEL: info
Expand Down

0 comments on commit d792e3d

Please sign in to comment.