AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Description: 'clickouts api deployment' Parameters: Env: Description: The environment name. Type: String Default: dev Resources: ClickoutFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: PostByFingerprint: Type: Api Properties: Path: '/{fingerprint}/clickouts' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-clickout' Handler: src/main/js/handlers/clickout.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 ClickoutFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ ClickoutFunction}' RetentionInDays: 7 StatusFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Get: Type: Api Properties: Path: '/_internal_/ping' Method: get Get: Type: Api Properties: Path: '/_internal_/status' Method: get Get: Type: Api Properties: Path: '/_internal_/version' Method: get Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-status' Handler: src/main/js/handlers/status.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 StatusFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ StatusFunction}' RetentionInDays: 7 Outputs: ClickoutFunction: Description: The name of the Lambda function for the Clickout model Value: !Ref ClickoutFunction Export: Name: !Sub '${AWS::StackName}-functions-Clickout' ClickoutFunctionRole: Description: The name of the Lambda function role for the Clickout model Value: !Ref ClickoutFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Clickout' StatusFunction: Description: The name of the Lambda function for the Status model Value: !Ref StatusFunction Export: Name: !Sub '${AWS::StackName}-functions-Status' StatusFunctionRole: Description: The name of the Lambda function role for the Status model Value: !Ref StatusFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Status'