Skip to content

Commit

Permalink
added dynamo perms to lambda function
Browse files Browse the repository at this point in the history
  • Loading branch information
Facundo De Lorenzo committed May 20, 2024
1 parent 19d0e0f commit dcaf0b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 0 additions & 1 deletion packages/api/src/orders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ exports.finish = async (
ReturnValues: 'ALL_NEW',
});
const response = await docClient.send(command) as Omit<UpdateCommandOutput, "Item"> & { Item: Order };
console.log('response: ', response);

const updatedItem = response.Attributes;
const updatedOrder: OrderDTO = {
Expand Down
12 changes: 12 additions & 0 deletions packages/api/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Description: Api
Globals:
Function:
Timeout: 10
Role: !GetAtt ExecutionRole.Arn

Resources:
MyApi:
Expand Down Expand Up @@ -91,3 +92,14 @@ Resources:
Method: GET
Path: /restaurants
RestApiId: !Ref MyApi

ExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument: Json
RoleName: APIExecutionRole
Policies:
- DynamoDBCrudPolicy:
TableName: wakeup-challenge-orders
- DynamoDBCrudPolicy:
TableName: wakeup-challenge-products

0 comments on commit dcaf0b7

Please sign in to comment.