From dcaf0b71489bb68828ec2776afcc86297c018e2d Mon Sep 17 00:00:00 2001 From: Facundo De Lorenzo Date: Mon, 20 May 2024 11:58:29 -0300 Subject: [PATCH] added dynamo perms to lambda function --- packages/api/src/orders.ts | 1 - packages/api/template.yaml | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/api/src/orders.ts b/packages/api/src/orders.ts index 1957900..0144d79 100644 --- a/packages/api/src/orders.ts +++ b/packages/api/src/orders.ts @@ -168,7 +168,6 @@ exports.finish = async ( ReturnValues: 'ALL_NEW', }); const response = await docClient.send(command) as Omit & { Item: Order }; - console.log('response: ', response); const updatedItem = response.Attributes; const updatedOrder: OrderDTO = { diff --git a/packages/api/template.yaml b/packages/api/template.yaml index d4f7250..6718718 100644 --- a/packages/api/template.yaml +++ b/packages/api/template.yaml @@ -5,6 +5,7 @@ Description: Api Globals: Function: Timeout: 10 + Role: !GetAtt ExecutionRole.Arn Resources: MyApi: @@ -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