interface SqsQueueProps
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Events.Targets.SqsQueueProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awseventstargets#SqsQueueProps |
Java | software.amazon.awscdk.services.events.targets.SqsQueueProps |
Python | aws_cdk.aws_events_targets.SqsQueueProps |
TypeScript (source) | aws-cdk-lib » aws_events_targets » SqsQueueProps |
Customize the SQS Queue Event Target.
Example
// FIFO queue - messageGroupId required
const fifoQueue = new sqs.Queue(this, 'MyFifoQueue', {
fifo: true,
});
const fifoRule = new events.Rule(this, 'FifoRule', {
schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});
fifoRule.addTarget(new targets.SqsQueue(fifoQueue, {
messageGroupId: 'MyMessageGroupId',
}));
// Standard queue - messageGroupId optional (SQS Fair queue feature)
const standardQueue = new sqs.Queue(this, 'MyStandardQueue');
const standardRule = new events.Rule(this, 'StandardRule', {
schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});
standardRule.addTarget(new targets.SqsQueue(standardQueue, {
messageGroupId: 'MyMessageGroupId', // Optional for standard queues
}));
Properties
| Name | Type | Description |
|---|---|---|
| dead | IQueue | The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue. |
| max | Duration | The maximum age of a request that Lambda sends to a function for processing. |
| message? | Rule | The message to send to the queue. |
| message | string | Message Group ID for messages sent to this queue. |
| retry | number | The maximum number of times to retry when the function returns an error. |
deadLetterQueue?
Type:
IQueue
(optional, default: no dead-letter queue)
The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue.
The events not successfully delivered are automatically retried for a specified period of time, depending on the retry policy of the target. If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.
maxEventAge?
Type:
Duration
(optional, default: Duration.hours(24))
The maximum age of a request that Lambda sends to a function for processing.
Minimum value of 60. Maximum value of 86400.
message?
Type:
Rule
(optional, default: the entire EventBridge event)
The message to send to the queue.
Must be a valid JSON text passed to the target queue.
messageGroupId?
Type:
string
(optional, default: no message group ID)
Message Group ID for messages sent to this queue.
Required for FIFO queues. For standard queues, this parameter is optional and can be used for SQS fair queue feature and deduplication.
retryAttempts?
Type:
number
(optional, default: 185)
The maximum number of times to retry when the function returns an error.
Minimum value of 0. Maximum value of 185.

.NET
Go
Java
Python
TypeScript (