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