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