Amazon Simple Storage Service Bucket LambdaConfiguration
LambdaConfigurations is a property of the Amazon S3 Bucket NotificationConfiguration property that describes the
AWS Lambda (Lambda) functions to invoke and the events for which to invoke them.
Syntax
Properties
Event-
The S3 bucket event for which to invoke the Lambda function. For more information, see Supported Event Types in the Amazon Simple Storage Service Developer Guide.
Required: Yes
Type: String
Filter-
The filtering rules that determine which objects invoke the Lambda function. For example, you can create a filter so that only image files with a
.jpgextension invoke the function when they are added to the S3 bucket.Required: No
Function-
The Amazon Resource Name (ARN) of the Lambda function that Amazon S3 invokes when the specified event type occurs.
Required: Yes
Type: String
Example
The following example creates a NotificationConfiguration for Lambda using
an S3 bucket named EncryptionServiceBucket.
Note
The BucketName is unique and the Value contains a file
extension without a period (.).
JSON
"EncryptionServiceBucket" : { "Type" : "AWS::S3::Bucket", "Properties" : { "BucketName" : { "Fn::Sub" : "${User}-encryption-service" }, "NotificationConfiguration" : { "LambdaConfigurations" : [{ "Function" : { "Ref" : "LambdaDeploymentArn" }, "Event" : "s3:ObjectCreated:*", "Filter" : { "S3Key" : { "Rules" : [{ "Name" : "suffix", "Value" : "zip" }] } } }] } } }
YAML
EncryptionServiceBucket: Type: AWS::S3::Bucket Properties: BucketName: !Sub ${User}-encryption-service NotificationConfiguration: LambdaConfigurations: - Function: !Ref LambdaDeploymentArn Event: "s3:ObjectCreated:*" Filter: S3Key: Rules: - Name: suffix Value: zip
