S3OnFailureDestination

class aws_cdk.aws_lambda_event_sources.S3OnFailureDestination(bucket)

Bases: object

An S3 dead letter bucket destination configuration for a Lambda event source.

ExampleMetadata:

infused

Example:

from aws_cdk.aws_lambda_event_sources import ManagedKafkaEventSource, S3OnFailureDestination
from aws_cdk.aws_s3 import IBucket

# bucket: IBucket
# my_function: lambda.Function


# Your MSK cluster arn
cluster_arn = "arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4"

# The Kafka topic you want to subscribe to
topic = "some-cool-topic"

s3_on_failure_destination = S3OnFailureDestination(bucket)

my_function.add_event_source(ManagedKafkaEventSource(
    cluster_arn=cluster_arn,
    topic=topic,
    starting_position=lambda_.StartingPosition.TRIM_HORIZON,
    on_failure=s3_on_failure_destination
))
Parameters:

bucket (IBucket) –

Methods

bind(_target, target_handler)

Returns a destination configuration for the DLQ.

Parameters:
Return type:

DlqDestinationConfig