Skip to content
v2.273.0

SqsDestination Class ​

Use an SQS queue as a bucket notification destination.

Example ​

ts
declare const myQueue: sqs.Queue;
const bucket = new s3.Bucket(this, 'MyBucket', {
  notificationsSkipDestinationValidation: true,
});
bucket.addEventNotification(s3.EventType.OBJECT_REMOVED, new s3n.SqsDestination(myQueue));
python
# my_queue: sqs.Queue

bucket = s3.Bucket(self, "MyBucket",
    notifications_skip_destination_validation=True
)
bucket.add_event_notification(s3.EventType.OBJECT_REMOVED, s3n.SqsDestination(my_queue))
java
Queue myQueue;

Bucket bucket = Bucket.Builder.create(this, "MyBucket")
        .notificationsSkipDestinationValidation(true)
        .build();
bucket.addEventNotification(EventType.OBJECT_REMOVED, new SqsDestination(myQueue));
csharp
// Install: dotnet add package Amazon.CDK.Lib
Queue myQueue;

var bucket = new Bucket(this, "MyBucket", new BucketProps {
    NotificationsSkipDestinationValidation = true
});
bucket.AddEventNotification(EventType.OBJECT_REMOVED, new SqsDestination(myQueue));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var myQueue Queue

bucket := s3.NewBucket(this, jsii.String("MyBucket"), &BucketProps{
	NotificationsSkipDestinationValidation: jsii.Boolean(true),
})
bucket.AddEventNotification(s3.EventType_OBJECT_REMOVED, s3n.NewSqsDestination(myQueue))

Initializer ​

ts
new SqsDestination(queue: IQueue)
python
SqsDestination(queue: IQueue)
java
new SqsDestination(IQueue queue)
csharp
new SqsDestination(IQueue queue)
go
NewSqsDestination(Queue IQueue)

Methods ​

bind(_scope: Construct, bucket: IBucketRef): BucketNotificationDestinationConfigdef bind(self, _scope: Construct, bucket: IBucketRef) -> BucketNotificationDestinationConfigpublic BucketNotificationDestinationConfig bind(Construct _scope, IBucketRef bucket)public BucketNotificationDestinationConfig Bind(Construct _scope, IBucketRef bucket)func Bind(_scope Construct, Bucket IBucketRef) BucketNotificationDestinationConfig#
Allows using SQS queues as destinations for bucket notifications.

Use bucket.onEvent(event, queue) to subscribe.