AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Description: 'paint-batch-optimizer deployment' Parameters: Env: Description: The environment name. Type: String Default: dev Resources: HealthcheckFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Get: Type: Api Properties: Path: '/_internal_/healthcheck' Method: get Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-healthcheck' Handler: src/main/js/handlers/healthcheck.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 HealthcheckFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ HealthcheckFunction}' RetentionInDays: 7 OptimizeRequestFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Post: Type: Api Properties: Path: '/v2/optimize' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-optimize-request' Handler: src/main/js/handlers/optimize_request.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 OptimizeRequestFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ OptimizeRequestFunction}' RetentionInDays: 7 Outputs: HealthcheckFunction: Description: The name of the Lambda function for the Healthcheck model Value: !Ref HealthcheckFunction Export: Name: !Sub '${AWS::StackName}-functions-Healthcheck' HealthcheckFunctionRole: Description: The name of the Lambda function role for the Healthcheck model Value: !Ref HealthcheckFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Healthcheck' OptimizeRequestFunction: Description: The name of the Lambda function for the OptimizeRequest model Value: !Ref OptimizeRequestFunction Export: Name: !Sub '${AWS::StackName}-functions-OptimizeRequest' OptimizeRequestFunctionRole: Description: The name of the Lambda function role for the OptimizeRequest model Value: !Ref OptimizeRequestFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-OptimizeRequest'