AWSTemplateFormatVersion: 2010-09-09 Description: Amazon DynamoDB stack for the Application Modernization Workshop/ Immersion Day Resources: DynamoDBTable: Type: AWS::DynamoDB::Table Properties: TableName: unishop BillingMode: PAY_PER_REQUEST AttributeDefinitions: - AttributeName: uuid AttributeType: S KeySchema: - AttributeName: uuid KeyType: HASH Tags: - Key: Name Value: MonoToMicroDDBTable - Key: AppName Value: UnicornShop LambdaRole: Type: AWS::IAM::Role Properties: RoleName: MonoToMicroLambdaRole ManagedPolicyArns: - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole - arn:aws:iam::aws:policy/AWSXRayDaemonWriteAccess - arn:aws:iam::aws:policy/CloudWatchLambdaInsightsExecutionRolePolicy AssumeRolePolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: Service: - lambda.amazonaws.com Action: - sts:AssumeRole Path: /service-role/ Policies: - PolicyName: LambdaDynamoDBAccess PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Action: - dynamodb:DescribeTable - dynamodb:GetItem - dynamodb:DeleteItem - dynamodb:PutItem - dynamodb:UpdateItem - dynamodb:Query - dynamodb:Scan Resource: !GetAtt DynamoDBTable.Arn Outputs: RoleForLambda: Value: !GetAtt LambdaRole.Arn