SQS queue event source for AWS Lambda function.
Install Node.js and npm first!
npm i @cfn-modules/lambda-event-source-sqs-queue
WARNING: We recommend to set the
ReservedConcurrentExecutions
parameter in the lambda-function module when using this module. If you do not set the parameter and many messages arrive, the Lambda function scales up to the regional limit which impacts other Lambda functions in the same region in your AWS account. For most use cases a value of 10 should be fine. If the SQS queue length grows you might want to increase the number.
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'cfn-modules example'
Resources:
EventSource:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
LambdaModule: !GetAtt 'Function.Outputs.StackName' # required
QueueModule: !GetAtt 'Queue.Outputs.StackName' # required
BatchSize: 10 # optional
TemplateURL: './node_modules/@cfn-modules/lambda-event-source-sqs-queue/module.yml'
Name | Description | Default | Required? | Allowed values |
---|---|---|---|---|
LambdaModule | Stack name of lambda-function module | yes | ||
QueueModule | Stack name of sqs-queue module | no | ||
BatchSize | The largest number of messages that Lambda retrieves from your queue at once. | 10 | no | [1-10000] |