AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Description: 'api-fraud deployment' Parameters: Env: Description: The environment name. Type: String Default: dev Resources: DecisionFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Post: Type: Api Properties: Path: '/decision' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-decision' Handler: src/main/js/handlers/decision.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 DecisionFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ DecisionFunction}' RetentionInDays: 7 TransactionFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Post: Type: Api Properties: Path: '/transaction' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-transaction' Handler: src/main/js/handlers/transaction.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 TransactionFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ TransactionFunction}' RetentionInDays: 7 Outputs: DecisionFunction: Description: The name of the Lambda function for the Decision model Value: !Ref DecisionFunction Export: Name: !Sub '${AWS::StackName}-functions-Decision' DecisionFunctionRole: Description: The name of the Lambda function role for the Decision model Value: !Ref DecisionFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Decision' TransactionFunction: Description: The name of the Lambda function for the Transaction model Value: !Ref TransactionFunction Export: Name: !Sub '${AWS::StackName}-functions-Transaction' TransactionFunctionRole: Description: The name of the Lambda function role for the Transaction model Value: !Ref TransactionFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Transaction'