SQS - Amazon Serverless Application Model
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

SQS

The object describing an SQS event source type. For more information, see Using Amazon Lambda with Amazon SQS in the Amazon Lambda Developer Guide.

SAM generates AWS::Lambda::EventSourceMapping resource when this event type is set

Syntax

To declare this entity in your Amazon Serverless Application Model (Amazon SAM) template, use the following syntax.

Properties

BatchSize

The maximum number of items to retrieve in a single batch.

Type: Integer

Required: No

Default: 10

Amazon CloudFormation compatibility: This property is passed directly to the BatchSize property of an AWS::Lambda::EventSourceMapping resource.

Minimum: 1

Maximum: 10000

Enabled

Disables the event source mapping to pause polling and invocation.

Type: Boolean

Required: No

Amazon CloudFormation compatibility: This property is passed directly to the Enabled property of an AWS::Lambda::EventSourceMapping resource.

FilterCriteria

A object that defines the criteria to determine whether Lambda should process an event. For more information, see Amazon Lambda event filtering in the Amazon Lambda Developer Guide.

Type: FilterCriteria

Required: No

Amazon CloudFormation compatibility: This property is passed directly to the FilterCriteria property of an AWS::Lambda::EventSourceMapping resource.

FunctionResponseTypes

A list of the response types currently applied to the event source mapping. For more information, see Reporting batch item failures in the Amazon Lambda Developer Guide.

Valid values: ReportBatchItemFailures

Type: List

Required: No

Amazon CloudFormation compatibility: This property is passed directly to the FunctionResponseTypes property of an AWS::Lambda::EventSourceMapping resource.

MaximumBatchingWindowInSeconds

The maximum amount of time, in seconds, to gather records before invoking the function.

Type: Integer

Required: No

Amazon CloudFormation compatibility: This property is passed directly to the MaximumBatchingWindowInSeconds property of an AWS::Lambda::EventSourceMapping resource.

Queue

The ARN of the queue.

Type: String

Required: Yes

Amazon CloudFormation compatibility: This property is passed directly to the EventSourceArn property of an AWS::Lambda::EventSourceMapping resource.

ScalingConfig

Scaling configuration of SQS pollers to control the invoke rate and set maximum concurrent invokes.

Type: ScalingConfig

Required: No

Amazon CloudFormation compatibility: This property is passed directly to the ScalingConfig property of an AWS::Lambda::EventSourceMapping resource.

Examples

Basic SQS event

Events: SQSEvent: Type: SQS Properties: Queue: arn:aws:sqs:us-west-2:012345678901:my-queue BatchSize: 10 Enabled: false FilterCriteria: Filters: - Pattern: '{"key": ["val1", "val2"]}'

Configure partial batch reporting for your SQS queue

Events: SQSEvent: Type: SQS Properties: Enabled: true FunctionResponseTypes: - ReportBatchItemFailures Queue: !GetAtt MySqsQueue.Arn BatchSize: 10

Lambda function with an SQS event that has scaling configured

MyFunction: Type: AWS::Serverless::Function Properties: ... Events: MySQSEvent: Type: SQS Properties: ... ScalingConfig: MaximumConcurrency: 10