LambdaDestination

class aws_cdk.aws_s3_notifications.LambdaDestination(fn)

Bases: object

Use a Lambda function as a bucket notification destination.

ExampleMetadata:

infused

Example:

# my_lambda: lambda.Function

bucket = s3.Bucket.from_bucket_attributes(self, "ImportedBucket",
    bucket_arn="arn:aws:s3:::my-bucket"
)

# now you can just call methods on the bucket
bucket.add_event_notification(s3.EventType.OBJECT_CREATED, s3n.LambdaDestination(my_lambda), prefix="home/myusername/*")
Parameters:

fn (IFunction)

Methods

bind(_scope, bucket)

Registers this resource to receive notifications for the specified bucket.

This method will only be called once for each destination/bucket pair and the result will be cached, so there is no need to implement idempotency in each destination.

Parameters:
Return type:

BucketNotificationDestinationConfig