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