AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Description: 'Zola Takehome deployment' Parameters: Env: Description: The environment name. Type: String Default: dev Resources: InvoiceFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Get: Type: Api Properties: Path: '/v1/invoices' Method: get Put: Type: Api Properties: Path: '/v1/invoices' Method: put Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-invoice' Handler: src/main/js/handlers/invoice.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 InvoiceFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ InvoiceFunction}' RetentionInDays: 7 Outputs: InvoiceFunction: Description: The name of the Lambda function for the Invoice model Value: !Ref InvoiceFunction Export: Name: !Sub '${AWS::StackName}-functions-Invoice' InvoiceFunctionRole: Description: The name of the Lambda function role for the Invoice model Value: !Ref InvoiceFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Invoice'