# This is the SAM template that represents the architecture of your serverless application # https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-template-basics.html # The AWSTemplateFormatVersion identifies the capabilities of the template # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/format-version-structure.html AWSTemplateFormatVersion: 2010-09-09 Description: >- lambda-ssm # Transform section specifies one or more macros that AWS CloudFormation uses to process your template # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-section-structure.html Transform: - AWS::Serverless-2016-10-31 # Resources declares the AWS resources that you want to include in the stack # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html Resources: # This is the Lambda function definition associated with the source code: sqs-payload-logger.js. For all available properties, see # https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction SQSPayloadLogger: Type: AWS::Serverless::Function Properties: Description: A Lambda function that logs the payload of messages sent to an associated SQS queue. Runtime: nodejs14.x Architectures: - x86_64 Handler: src/handlers/sqs-payload-logger.sqsPayloadLoggerHandler # This property associates this Lambda function with the SQS queue defined above, so that whenever the queue # receives a message, the Lambda function is invoked Events: SQSQueueEvent: Type: SQS Properties: # This property resolves a ssm parameter that contains the arn of the sqs queue Queue: !Sub '{{resolve:ssm:terraform-example-queue-arn:1}}' BatchSize: 1 MemorySize: 128 Timeout: 25 # Chosen to be less than the default SQS Visibility Timeout of 30 seconds Policies: - AWSLambdaBasicExecutionRole - SQSPollerPolicy: QueueName: 'terraform-example-queue'