Transform: 'AWS::Serverless-2016-10-31' Parameters: ExistingCDRBucketName: Description: "Existing CDR bucket that is used in Chime Voice Connector" Type: "String" TargetBucketName: Description: "S3 bucket name to place the enriched CDR records" Type: "String" Format: Description: "Supports JSON or CSV format" Type: "String" Default: "JSON" LambdaCode: Description: "Please make sure the lambda code is uploaded to your existing CDR bucket." Type: "String" Default: "pricefunction-1.0.0.jar" Resources: LambdaFunctionHandler: # This resource creates a Lambda function. Type: 'AWS::Serverless::Function' Properties: Description: Lambda handler for enriching CDR records with price per call # Time out value to 30 seconds Timeout: 30 # Initial Memory size MemorySize: 512 # The location of the Lambda function code. # CloudFormation: When using with cloudformation, bucket must exists and code must be uploaded. # Sam: Builds code using maven. Defaults to './' when used with sam. Same as CudeURI: ./ #CodeUri: ./ CodeUri: #!Ref function allows you to fetch value #of parameters and other resources at runtime Bucket: !Ref TargetBucketName Key: !Ref LambdaCode # This function uses Java8 runtime. Runtime: java8 # This is the Lambda function's handler. Handler: com.amazonaws.samples.chimevoiceconnector.LambdaFunctionHandler #Lambda enviornment variables Environment: Variables: TARGET_BUCKET_NAME: !Ref TargetBucketName OUTPUT_FORMAT: !Ref Format #Lambda inline policy Policies: - AWSLambdaExecute # Managed Policy - Version: '2012-10-17' # Policy Document Statement: #- Allow read only access to data - Sid: PricingPolicy Effect: Allow Action: - 'pricing:*' Resource: '*'