AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Description: 'Termsteelversionapi deployment' Parameters: Env: Description: The environment name. Type: String Default: dev Resources: GeneratorFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Get: Type: Api Properties: Path: '/generators' Method: get GetByKey: Type: Api Properties: Path: '/generators/{key}' Method: get Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-generator' Handler: src/main/js/handlers/generator.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 GeneratorFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ GeneratorFunction}' RetentionInDays: 7 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 InvocationFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: PostByKey: Type: Api Properties: Path: '/invocations/{key}' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-invocation' Handler: src/main/js/handlers/invocation.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 InvocationFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ InvocationFunction}' RetentionInDays: 7 Outputs: GeneratorFunction: Description: The name of the Lambda function for the Generator model Value: !Ref GeneratorFunction Export: Name: !Sub '${AWS::StackName}-functions-Generator' GeneratorFunctionRole: Description: The name of the Lambda function role for the Generator model Value: !Ref GeneratorFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Generator' 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' InvocationFunction: Description: The name of the Lambda function for the Invocation model Value: !Ref InvocationFunction Export: Name: !Sub '${AWS::StackName}-functions-Invocation' InvocationFunctionRole: Description: The name of the Lambda function role for the Invocation model Value: !Ref InvocationFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Invocation'